From 03c22862322f42a68351e70956e24e512028f0b2 Mon Sep 17 00:00:00 2001 From: Elrond Date: Sun, 25 Dec 2011 16:01:25 +0100 Subject: [PATCH] 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. --- mediagoblin/db/sql/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mediagoblin/db/sql/base.py b/mediagoblin/db/sql/base.py index 5e420bdc..1249bace 100644 --- a/mediagoblin/db/sql/base.py +++ b/mediagoblin/db/sql/base.py @@ -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) -- 2.25.1