hil
hil copied to clipboard
Create __repr__ entries for DB objects
While debugging some haas code, I am noticing that it'd be really nice to have something more useful as the repr than stuff like <haas.model.Project at 0x3f70a10>.
To do this, one needs to define a __repr__ entry for each class. An example is:
def __repr__(self):
return "<Node %r>" % (self.label)
If we had a standard baseclass, we could do this once and everything could inherit from that (not sure if db.Model can do that), though that may not work for tables lacking a standard variable to use like label.