-
-class FormattableRecord(Record):
- _format = {}
- def _formatField(self, field):
- func = self._format.get(field)
- if func:
- return func(self.get(field))
- else:
- return super(FormattableRecord, self)._formatField(field)
-
-class NullableRecord(FormattableRecord):
- _default = {}
- def get(self, field):
- v = self.__dict__.get(field)
- if v != None:
- return v
- else:
- return self._default.get(field)