comparison rhodecode/model/meta.py @ 1203:6832ef664673 beta

source code cleanup: remove trailing white space, normalize file endings
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 03 Apr 2011 18:23:15 +0200
parents 5d676b6ab71c
children aa7e45ad0cea
comparison
equal deleted inserted replaced
1202:eef9e273347a 1203:6832ef664673
19 ) 19 )
20 ) 20 )
21 21
22 class BaseModel(object): 22 class BaseModel(object):
23 """Base Model for all classess 23 """Base Model for all classess
24 24
25 """ 25 """
26 26
27 @classmethod 27 @classmethod
28 def _get_keys(cls): 28 def _get_keys(cls):
29 """return column names for this model """ 29 """return column names for this model """
30 return class_mapper(cls).c.keys() 30 return class_mapper(cls).c.keys()
31 31
32 def get_dict(self): 32 def get_dict(self):
33 """return dict with keys and values corresponding 33 """return dict with keys and values corresponding
34 to this model data """ 34 to this model data """
35 35
36 d = {} 36 d = {}
37 for k in self._get_keys(): 37 for k in self._get_keys():
38 d[k] = getattr(self, k) 38 d[k] = getattr(self, k)
39 return d 39 return d
40 40
41 def get_appstruct(self): 41 def get_appstruct(self):
42 """return list with keys and values tupples corresponding 42 """return list with keys and values tupples corresponding
43 to this model data """ 43 to this model data """
44 44
45 l = [] 45 l = []
46 for k in self._get_keys(): 46 for k in self._get_keys():
47 l.append((k, getattr(self, k),)) 47 l.append((k, getattr(self, k),))