add a 'fullid' property to get 'ID@backend'

This commit is contained in:
Romain Bignon 2012-02-18 12:27:18 +01:00
commit f6c2edc64f

View file

@ -21,13 +21,13 @@
from weboob.tools.misc import iter_fields
__all__ = ['FieldNotFound', 'IBaseCap', 'NotAvailable', 'NotLoaded',
__all__ = ['FieldNotFound', 'IBaseCap', 'NotAvailable', 'NotLoaded',
'CapBaseObject']
class FieldNotFound(Exception):
def __init__(self, obj, field):
Exception.__init__(self,
Exception.__init__(self,
u'Field "%s" not found for object %s' % (field, obj))
@ -72,6 +72,10 @@ class CapBaseObject(object):
self.id = id
self.backend = backend
@property
def fullid(self):
return '%s@%s' % (self.id, self.backend)
def add_field(self, name, type, value=NotLoaded):
"""
Add a field in list, which needs to be of type @type.