added custom field-record validator support, not using it yet though

This commit is contained in:
Binh 2011-04-23 14:57:18 -05:00
parent edb8e90340
commit f30237a90d
2 changed files with 8 additions and 0 deletions

View file

@ -33,6 +33,13 @@ class Model(object):
for f in self.get_fields():
f.validate()
try:
custom_validator = getattr(self, 'validate_' + f.name)
except AttributeError, e:
continue
if callable(custom_validator):
custom_validator(f)
def output(self):
return ''.join([self.record_identifier] + [field.get_data() for field in self.get_sorted_fields()])