Skip to content

Instantly share code, notes, and snippets.

View sgrove's full-sized avatar
💭
Infinigraph, and beyond!

Sean Grove sgrove

💭
Infinigraph, and beyond!
View GitHub Profile
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 = []