ObjectNotSupported is now an assertion

This commit is contained in:
Christophe Benz 2010-08-12 16:45:05 +02:00
commit d81f5dac7a
3 changed files with 5 additions and 10 deletions

View file

@ -24,17 +24,13 @@ from logging import debug
from weboob.capabilities.base import IBaseCap, NotLoaded
__all__ = ['BaseBackend', 'ObjectNotAvailable', 'ObjectNotSupported']
__all__ = ['BaseBackend', 'ObjectNotAvailable']
class ObjectNotAvailable(Exception):
pass
class ObjectNotSupported(Exception):
pass
class BackendStorage(object):
def __init__(self, name, storage):
self.name = name
@ -222,9 +218,9 @@ class BaseBackend(object):
if not missing_fields:
return obj
assert obj in self.OBJECTS, 'The object of type %s is not supported by the backend %s' % (type(obj), self)
for key, value in self.OBJECTS.iteritems():
if isinstance(obj, key):
debug(u'Fill %r with fields: %s' % (obj, missing_fields))
return value(self, obj, missing_fields) or obj
raise ObjectNotSupported('The object of type %s is not supported by the backend %s' % (type(obj), self))