Changeset - 4582e6b9e2f6
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2012-01-24 19:02:21
marcin@python-works.com
get_dict function garden
1 file changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/db.py
Show inline comments
 
@@ -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):
0 comments (0 inline, 0 general)