Show More
@@ -94,20 +94,18 b' class BaseModel(object):' | |||
|
94 | 94 | """return column names for this model """ |
|
95 | 95 | return class_mapper(cls).c.keys() |
|
96 | 96 | |
|
97 |
def get_dict(self |
|
|
97 | def get_dict(self): | |
|
98 | 98 | """ |
|
99 | 99 | return dict with keys and values corresponding |
|
100 | to this model data | |
|
101 | """ | |
|
100 | to this model data """ | |
|
102 | 101 | |
|
103 | 102 | d = {} |
|
104 | 103 | for k in self._get_keys(): |
|
105 | 104 | d[k] = getattr(self, k) |
|
106 | 105 | |
|
107 | 106 | # also use __json__() if present to get additional fields |
|
108 | if hasattr(self, '__json__'): | |
|
109 | for k, val in self.__json__().iteritems(): | |
|
110 | d[k] = val | |
|
107 | for k, val in getattr(self, '__json__', lambda: {})().iteritems(): | |
|
108 | d[k] = val | |
|
111 | 109 | return d |
|
112 | 110 | |
|
113 | 111 | def get_appstruct(self): |
General Comments 0
You need to be logged in to leave comments.
Login now