Mercurial > kallithea
changeset 1948:4582e6b9e2f6 beta
get_dict function garden
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 24 Jan 2012 20:02:21 +0200 |
parents | 72e160dff58e |
children | 0471cbe8b4a7 af01b0020901 |
files | rhodecode/model/db.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/model/db.py Mon Jan 23 18:29:05 2012 +0200 +++ b/rhodecode/model/db.py Tue Jan 24 20:02:21 2012 +0200 @@ -94,20 +94,18 @@ """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):