class Character(NameObject, Base): __metaclass__ = CharacterMeta __tablename__ = 'character' id = Column(Integer, primary_key=True) def __init__(self, *args, **kwargs): NameObject.__init__(self) Base.__init__(self, *args, **kwargs) self.setup(**kwargs) def setup(self, **kwargs): self.attributes = AttributesManager(character=self, **kwargs) @reconstructor def init_on_load(self): self.setup() def display(self): for section, attributes in self.attributes.attributes_cls.items(): print('{0}\n{1}\n'.format(section, "*" * len(section))) for a in attributes: attribute = self.attributes.get(a.clsname()) key = attribute.clsname() if isinstance(attribute.value, type): value = attribute.value.clsname() else: value = attribute.value print('{0}: {1}'.format(key, value)) print('\n')