The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit 3a05b29b authored by Baptiste Delpey's avatar Baptiste Delpey Committed by Romain Bignon

add BrowserToBeContinued exception and handle it

parent 81503a88
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>. # along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.value import Value
class BrowserIncorrectPassword(Exception): class BrowserIncorrectPassword(Exception):
pass pass
...@@ -38,6 +39,13 @@ class BrowserUnavailable(Exception): ...@@ -38,6 +39,13 @@ class BrowserUnavailable(Exception):
pass pass
class BrowserToBeContinued(BrowserUnavailable):
def __init__(self, *args):
self.fields = []
for arg in args:
self.fields.append(Value(label=arg))
class BrowserHTTPNotFound(BrowserUnavailable): class BrowserHTTPNotFound(BrowserUnavailable):
pass pass
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
from weboob.core.backendscfg import BackendAlreadyExists from weboob.core.backendscfg import BackendAlreadyExists
from weboob.core.modules import ModuleLoadError from weboob.core.modules import ModuleLoadError
from weboob.core.repositories import ModuleInstallError, IProgress from weboob.core.repositories import ModuleInstallError, IProgress
from weboob.exceptions import BrowserUnavailable, BrowserIncorrectPassword, BrowserForbidden, BrowserSSLError from weboob.exceptions import BrowserUnavailable, BrowserIncorrectPassword, BrowserForbidden, BrowserSSLError, BrowserToBeContinued
from weboob.tools.value import Value, ValueBool, ValueFloat, ValueInt, ValueBackendPassword from weboob.tools.value import Value, ValueBool, ValueFloat, ValueInt, ValueBackendPassword
from weboob.tools.misc import to_unicode from weboob.tools.misc import to_unicode
from weboob.tools.ordereddict import OrderedDict from weboob.tools.ordereddict import OrderedDict
...@@ -560,6 +560,11 @@ def bcall_error_handler(self, backend, error, backtrace): ...@@ -560,6 +560,11 @@ def bcall_error_handler(self, backend, error, backtrace):
print(u'FATAL(%s): ' % backend.name + self.BOLD + '/!\ SERVER CERTIFICATE IS INVALID /!\\' + self.NC, file=self.stderr) print(u'FATAL(%s): ' % backend.name + self.BOLD + '/!\ SERVER CERTIFICATE IS INVALID /!\\' + self.NC, file=self.stderr)
elif isinstance(error, BrowserForbidden): elif isinstance(error, BrowserForbidden):
print(u'Error(%s): %s' % (backend.name, msg or 'Forbidden'), file=self.stderr) print(u'Error(%s): %s' % (backend.name, msg or 'Forbidden'), file=self.stderr)
elif isinstance(error, BrowserToBeContinued):
for field in error.fields:
v = self.ask(field)
if v:
backend.config[field.label].set(v)
elif isinstance(error, BrowserUnavailable): elif isinstance(error, BrowserUnavailable):
msg = unicode(error) msg = unicode(error)
if not msg: if not msg:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment