Support .get(fieldname) on sql db objects

Some parts of the code like to call .get("somefield") on
the db objects.  It's easy to support this on sqlalchemy
based objects, so lets do it.
This commit is contained in:
Elrond 2011-12-25 16:01:25 +01:00
parent 690672580e
commit 03c2286232

View File

@ -25,3 +25,6 @@ class GMGTableBase(object):
@classmethod
def one(cls, query_dict):
return cls.find(query_dict).one()
def get(self, key):
return getattr(self, key)