##// END OF EJS Templates
get_dict function garden
marcink -
r1948:4582e6b9 beta
parent child Browse files
Show More
@@ -94,19 +94,17 b' class BaseModel(object):'
94 """return column names for this model """
94 """return column names for this model """
95 return class_mapper(cls).c.keys()
95 return class_mapper(cls).c.keys()
96
96
97 def get_dict(self, serialized=False):
97 def get_dict(self):
98 """
98 """
99 return dict with keys and values corresponding
99 return dict with keys and values corresponding
100 to this model data
100 to this model data """
101 """
102
101
103 d = {}
102 d = {}
104 for k in self._get_keys():
103 for k in self._get_keys():
105 d[k] = getattr(self, k)
104 d[k] = getattr(self, k)
106
105
107 # also use __json__() if present to get additional fields
106 # also use __json__() if present to get additional fields
108 if hasattr(self, '__json__'):
107 for k, val in getattr(self, '__json__', lambda: {})().iteritems():
109 for k, val in self.__json__().iteritems():
110 d[k] = val
108 d[k] = val
111 return d
109 return d
112
110
General Comments 0
You need to be logged in to leave comments. Login now