UX improvements for Google storage

Fix #549
Fix #552
This commit is contained in:
Markus Unterwaditzer 2017-02-18 15:54:16 +01:00
parent 10490a12f1
commit 7f38102936
2 changed files with 9 additions and 0 deletions

View file

@ -185,6 +185,10 @@ Service to hardcode those into opensource software
4. Finally you should have a Client ID and a Client secret. Provide these in
your storage config.
The ``token_file`` parameter should be a filepath where vdirsyncer can later
store authentication-related data. You do not need to create the file itself
(or write anything to it), only the folder around it.
You can select which calendars to sync on `CalDav settings page
<https://calendar.google.com/calendar/syncselect>`_.

View file

@ -51,6 +51,11 @@ class GoogleSession(dav.DAVSession):
token = json.load(f)
except (OSError, IOError):
pass
except ValueError as e:
raise exceptions.UserError(
'Failed to load token file {}, try deleting it. '
'Original error: {}'.format(token_file, e)
)
def _save_token(token):
with atomic_write(token_file, mode='w', overwrite=True) as f: