implement fillobj() browser method
This commit is contained in:
parent
90756cddc9
commit
3175883351
13 changed files with 164 additions and 129 deletions
|
|
@ -270,6 +270,40 @@ class ConsoleApplication(BaseApplication):
|
|||
logging.error(e)
|
||||
|
||||
def do(self, function, *args, **kwargs):
|
||||
if self.selected_fields:
|
||||
kwargs['required_fields'] = set(self.selected_fields) - set('*')
|
||||
return self.weboob.do(function, *args, **kwargs)
|
||||
"""
|
||||
Call Weboob.do(), after having filled the yielded object, if selected fields are given by user.
|
||||
"""
|
||||
for backend, result in self.weboob.do(function, *args, **kwargs):
|
||||
fields = set(self.selected_fields) - set('*')
|
||||
if fields:
|
||||
try:
|
||||
backend.browser.fillobj(result, fields)
|
||||
except Exception, e:
|
||||
logging.warning(u'Could not retrieve required fields (%s): %s' % (','.join(fields), e))
|
||||
yield backend, result
|
||||
|
||||
def do_caps(self, caps, function, *args, **kwargs):
|
||||
"""
|
||||
Call Weboob.do_caps(), after having filled the yielded object, if selected fields are given by user.
|
||||
"""
|
||||
for backend, result in self.weboob.do_caps(caps, function, *args, **kwargs):
|
||||
fields = set(self.selected_fields) - set('*')
|
||||
if fields:
|
||||
try:
|
||||
backend.browser.fillobj(result, fields)
|
||||
except Exception, e:
|
||||
logging.warning(u'Could not retrieve required fields (%s): %s' % (','.join(fields), e))
|
||||
yield backend, result
|
||||
|
||||
def do_backends(self, backends, function, *args, **kwargs):
|
||||
"""
|
||||
Call Weboob.do_backends(), after having filled the yielded object, if selected fields are given by user.
|
||||
"""
|
||||
for backend, result in self.weboob.do_backends(backends, function, *args, **kwargs):
|
||||
fields = set(self.selected_fields) - set('*')
|
||||
if fields:
|
||||
try:
|
||||
backend.browser.fillobj(result, fields)
|
||||
except Exception, e:
|
||||
logging.warning(u'Could not retrieve required fields (%s): %s' % (','.join(fields), e))
|
||||
yield backend, result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue