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.
This commit is contained in:
Christian Geier 2014-02-27 19:13:31 +01:00 committed by Markus Unterwaditzer
parent 55c33d749b
commit f6af9697a9

View file

@ -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):