do not cry if an object in not support to be filled by a backend
This commit is contained in:
parent
9d693bd982
commit
8550c17cf7
4 changed files with 15 additions and 39 deletions
|
|
@ -30,7 +30,6 @@ from weboob.capabilities.base import NotAvailable, NotLoaded, ConversionWarning
|
|||
from weboob.core import Weboob, CallErrors
|
||||
from weboob.core.backendscfg import BackendsConfig
|
||||
from weboob.tools.config.iconfig import ConfigError
|
||||
from weboob.tools.backend import ObjectNotAvailable
|
||||
from weboob.tools.log import createColoredFormatter, getLogger
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
||||
|
|
@ -236,13 +235,7 @@ class BaseApplication(object):
|
|||
|
||||
def _do_complete_obj(self, backend, fields, obj):
|
||||
if fields is None or len(fields) > 0:
|
||||
try:
|
||||
backend.fillobj(obj, fields)
|
||||
except ObjectNotAvailable, e:
|
||||
logging.warning(u'Could not retrieve required fields (%s): %s' % (','.join(fields), e))
|
||||
for field in fields:
|
||||
if getattr(obj, field) is NotLoaded:
|
||||
setattr(obj, field, NotAvailable)
|
||||
backend.fillobj(obj, fields)
|
||||
return obj
|
||||
|
||||
def _do_complete_iter(self, backend, count, fields, res):
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ from optparse import OptionGroup, OptionParser, IndentedHelpFormatter
|
|||
import os
|
||||
import sys
|
||||
|
||||
from weboob.capabilities.base import FieldNotFound, CapBaseObject, ObjectNotSupported, UserError
|
||||
from weboob.capabilities.base import FieldNotFound, CapBaseObject, UserError
|
||||
from weboob.core import CallErrors
|
||||
from weboob.tools.application.formatters.iformatter import MandatoryFieldsNotFound
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
|
@ -206,22 +206,13 @@ class ReplApplication(Cmd, ConsoleApplication):
|
|||
try:
|
||||
backend = self.weboob.get_backend(obj.backend)
|
||||
return backend.fillobj(obj, fields)
|
||||
except ObjectNotSupported:
|
||||
pass
|
||||
except UserError, e:
|
||||
self.bcall_error_handler(backend, e, '')
|
||||
|
||||
_id, backend_name = self.parse_id(_id)
|
||||
backend_names = (backend_name,) if backend_name is not None else self.enabled_backends
|
||||
for backend, obj in self.do(method, _id, backends=backend_names):
|
||||
for backend, obj in self.do(method, _id, backends=backend_names, fields=fields):
|
||||
if obj:
|
||||
try:
|
||||
backend.fillobj(obj, fields)
|
||||
except ObjectNotSupported:
|
||||
pass
|
||||
except UserError, e:
|
||||
self.bcall_error_handler(backend, e, '')
|
||||
|
||||
return obj
|
||||
|
||||
def get_object_list(self, method=None):
|
||||
|
|
@ -291,7 +282,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
|||
backends = kwargs.pop('backends', None)
|
||||
kwargs['backends'] = self.enabled_backends if backends is None else backends
|
||||
kwargs['condition'] = self.condition
|
||||
fields = self.selected_fields
|
||||
fields = kwargs.pop('fields', self.selected_fields)
|
||||
if '$direct' in fields:
|
||||
fields = []
|
||||
elif '$full' in fields:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue