This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Validated: | |
__fields__ = {} # field -> validator list | |
def validate(self): | |
errors = [] | |
for field, validators in self.__fields__.iteritems(): | |
if not hasattr(self, field): | |
errors.append("field %s missing" % field) | |
continue | |
field_errors = [] |