mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Merge pull request #406 from pimutils/fix-google2
More bugfixes for Google
This commit is contained in:
commit
69b88dd0c0
2 changed files with 12 additions and 9 deletions
|
|
@ -387,7 +387,7 @@ def storage_instance_from_config(config, create=True):
|
||||||
|
|
||||||
def handle_storage_init_error(cls, config):
|
def handle_storage_init_error(cls, config):
|
||||||
e = sys.exc_info()[1]
|
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
|
raise
|
||||||
|
|
||||||
all, required = get_storage_init_args(cls)
|
all, required = get_storage_init_args(cls)
|
||||||
|
|
@ -398,19 +398,17 @@ def handle_storage_init_error(cls, config):
|
||||||
problems = []
|
problems = []
|
||||||
|
|
||||||
if missing:
|
if missing:
|
||||||
cli_logger.critical(
|
problems.append(
|
||||||
u'{} storage requires the parameters: {}'
|
u'{} storage requires the parameters: {}'
|
||||||
.format(cls.storage_name, u', '.join(missing)))
|
.format(cls.storage_name, u', '.join(missing)))
|
||||||
|
|
||||||
if invalid:
|
if invalid:
|
||||||
cli_logger.critical(
|
problems.append(
|
||||||
u'{} storage doesn\'t take the parameters: {}'
|
u'{} storage doesn\'t take the parameters: {}'
|
||||||
.format(cls.storage_name, u', '.join(invalid)))
|
.format(cls.storage_name, u', '.join(invalid)))
|
||||||
|
|
||||||
if not problems:
|
if not problems: # XXX: Py2: Proper reraise
|
||||||
if not isinstance(e, exceptions.UserError):
|
raise e
|
||||||
cli_logger.exception('')
|
|
||||||
problems.append(str(e))
|
|
||||||
|
|
||||||
raise exceptions.UserError(
|
raise exceptions.UserError(
|
||||||
u'Failed to initialize {}'.format(config['instance_name']),
|
u'Failed to initialize {}'.format(config['instance_name']),
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,17 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
class GoogleSession(dav.DavSession):
|
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
|
# Not a default in function signature, otherwise these show up in user
|
||||||
# documentation
|
# documentation
|
||||||
client_id = client_id or CLIENT_ID
|
client_id = client_id or CLIENT_ID
|
||||||
client_secret = client_secret or CLIENT_SECRET
|
client_secret = client_secret or CLIENT_SECRET
|
||||||
|
|
||||||
|
# Required for discovering collections
|
||||||
|
if url is not None:
|
||||||
|
self.url = url
|
||||||
|
|
||||||
self.useragent = client_id
|
self.useragent = client_id
|
||||||
self._settings = {}
|
self._settings = {}
|
||||||
|
|
||||||
|
|
@ -157,4 +162,4 @@ class GoogleContactsStorage(dav.CarddavStorage):
|
||||||
# This is ugly: We define/override the entire signature computed for the
|
# This is ugly: We define/override the entire signature computed for the
|
||||||
# docs here because the current way we autogenerate those docs are too
|
# docs here because the current way we autogenerate those docs are too
|
||||||
# simple for our advanced argspec juggling in `vdirsyncer.storage.dav`.
|
# simple for our advanced argspec juggling in `vdirsyncer.storage.dav`.
|
||||||
__init__._traverse_superclass = False
|
__init__._traverse_superclass = base.Storage
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue