Show More
@@ -94,20 +94,18 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 |
|
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(): |
|
108 | d[k] = val | |
110 | d[k] = val |
|
|||
111 | return d |
|
109 | return d | |
112 |
|
110 | |||
113 | def get_appstruct(self): |
|
111 | def get_appstruct(self): |
General Comments 0
You need to be logged in to leave comments.
Login now