diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py
index 17f22f5..a5136ed 100644
--- a/vdirsyncer/storage/dav.py
+++ b/vdirsyncer/storage/dav.py
@@ -322,34 +322,41 @@ class DavStorage(Storage):
return c
home = d.find_home()
- collection_url = '{}/{}'.format(home.rstrip('/'), collection)
-
- data = '''
-
-
-
-
-
-
-
-
-
-
- '''.format(cls._dav_namespace, cls._dav_resourcetype)
-
- headers = d.session.get_default_headers()
+ url = '{}/{}'.format(home.rstrip('/'), collection)
try:
- response = d.session.request('MKCOL', collection_url, data=data,
- headers=headers)
+ url = cls._create_collection_impl(d, url, kwargs)
except HTTPError as e:
raise NotImplementedError(e)
else:
rv = dict(kwargs)
rv['collection'] = collection
- rv['url'] = response.url
+ rv['url'] = url
return rv
+ @classmethod
+ def _create_collection_impl(cls, d, url, kwargs):
+ data = '''
+
+
+
+
+
+
+
+
+
+
+ '''.format(cls._dav_namespace, cls._dav_resourcetype)
+
+ response = d.session.request(
+ 'MKCOL',
+ url,
+ data=data,
+ headers=d.session.get_default_headers(),
+ )
+ return response.url
+
def _normalize_href(self, *args, **kwargs):
return _normalize_href(self.session.url, *args, **kwargs)