diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index d896e80..d4f2c73 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -387,7 +387,7 @@ def storage_instance_from_config(config, create=True): def handle_storage_init_error(cls, config): e = sys.exc_info()[1] - if isinstance(e, (click.Abort, exceptions.UserError, KeyboardInterrupt)): + if not isinstance(e, TypeError) or '__init__' not in repr(e): raise all, required = get_storage_init_args(cls) @@ -398,19 +398,17 @@ def handle_storage_init_error(cls, config): problems = [] if missing: - cli_logger.critical( + problems.append( u'{} storage requires the parameters: {}' .format(cls.storage_name, u', '.join(missing))) if invalid: - cli_logger.critical( + problems.append( u'{} storage doesn\'t take the parameters: {}' .format(cls.storage_name, u', '.join(invalid))) - if not problems: - if not isinstance(e, exceptions.UserError): - cli_logger.exception('') - problems.append(str(e)) + if not problems: # XXX: Py2: Proper reraise + raise e raise exceptions.UserError( u'Failed to initialize {}'.format(config['instance_name']), diff --git a/vdirsyncer/storage/google.py b/vdirsyncer/storage/google.py index e57ad15..263e100 100644 --- a/vdirsyncer/storage/google.py +++ b/vdirsyncer/storage/google.py @@ -26,12 +26,17 @@ except ImportError: class GoogleSession(dav.DavSession): - def __init__(self, token_file, client_id=None, client_secret=None): + def __init__(self, token_file, url=None, client_id=None, + client_secret=None): # Not a default in function signature, otherwise these show up in user # documentation client_id = client_id or CLIENT_ID client_secret = client_secret or CLIENT_SECRET + # Required for discovering collections + if url is not None: + self.url = url + self.useragent = client_id self._settings = {} @@ -157,4 +162,4 @@ class GoogleContactsStorage(dav.CarddavStorage): # This is ugly: We define/override the entire signature computed for the # docs here because the current way we autogenerate those docs are too # simple for our advanced argspec juggling in `vdirsyncer.storage.dav`. - __init__._traverse_superclass = False + __init__._traverse_superclass = base.Storage