From f6af9697a9f20e7b36dffce32ee740548f03a0bf Mon Sep 17 00:00:00 2001 From: Christian Geier Date: Thu, 27 Feb 2014 19:13:31 +0100 Subject: [PATCH] bugfix: odd error message if URL not WebDAV If the queried URL is not speaking WebDAV, there is no 'DAV' response header and a misleading (to the end user) exception is raised. I've wanted to fix this for some time in khal. --- vdirsyncer/storage/caldav.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vdirsyncer/storage/caldav.py b/vdirsyncer/storage/caldav.py index 5d378cc..ed82b1a 100644 --- a/vdirsyncer/storage/caldav.py +++ b/vdirsyncer/storage/caldav.py @@ -77,7 +77,7 @@ class CaldavStorage(Storage): headers=headers ) response.raise_for_status() - if 'calendar-access' not in response.headers['DAV']: + if 'DAV' not in response.headers or 'calendar-access' not in response.headers['DAV']: raise exceptions.StorageError('URL is not a CalDAV collection') def _default_headers(self):