# HG changeset patch # User Marcin Kuzminski # Date 2012-01-24 18:02:21 # Node ID 4582e6b9e2f6b5b4d833a1f87a9001134736ecb2 # Parent 72e160dff58e5416d646f942c292687eca471387 get_dict function garden diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -94,20 +94,18 @@ class BaseModel(object): """return column names for this model """ return class_mapper(cls).c.keys() - def get_dict(self, serialized=False): + def get_dict(self): """ return dict with keys and values corresponding - to this model data - """ + to this model data """ d = {} for k in self._get_keys(): d[k] = getattr(self, k) # also use __json__() if present to get additional fields - if hasattr(self, '__json__'): - for k, val in self.__json__().iteritems(): - d[k] = val + for k, val in getattr(self, '__json__', lambda: {})().iteritems(): + d[k] = val return d def get_appstruct(self):