mirror of https://github.com/veops/cmdb.git
pep8
This commit is contained in:
parent
332659c1d5
commit
f78c3b928b
|
@ -10,9 +10,14 @@ from api.lib.exception import CommitException
|
||||||
|
|
||||||
class FormatMixin(object):
|
class FormatMixin(object):
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return dict([(k.name, isinstance(getattr(self, k.name), datetime.datetime) and
|
res = dict()
|
||||||
getattr(self, k.name).strftime('%Y-%m-%d %H:%M:%S')) or
|
for k in getattr(self, "__table__").columns:
|
||||||
getattr(self, k.name) for k in getattr(self, "__table__").columns])
|
if not isinstance(getattr(self, k.name), datetime.datetime):
|
||||||
|
res[k.name] = getattr(self, k.name)
|
||||||
|
else:
|
||||||
|
res[k.name] = getattr(self, k.name).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_columns(cls):
|
def get_columns(cls):
|
||||||
|
|
Loading…
Reference in New Issue