refs #1060 : move to_dict to base.py
This commit is contained in:
parent
8d8fe9090f
commit
1b47455225
2 changed files with 16 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright(C) 2010-2011 Christophe Benz, Romain Bignon
|
||||
# Copyright(C) 2010-2013 Christophe Benz, Romain Bignon, Julien Hebert
|
||||
#
|
||||
# This file is part of weboob.
|
||||
#
|
||||
|
|
@ -389,3 +389,15 @@ class CapBaseObject(object):
|
|||
self._fields.pop(name)
|
||||
except KeyError:
|
||||
object.__delattr__(self, name)
|
||||
|
||||
def to_dict(self):
|
||||
def iter_decorate(d):
|
||||
for key, value in d:
|
||||
if key == 'id' and self.backend is not None:
|
||||
value = self.fullid
|
||||
yield key, value
|
||||
|
||||
fields_iterator = self.iter_fields()
|
||||
return OrderedDict(iter_decorate(fields_iterator))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue