Skip to content

Commit 8ad7dcb

Browse files
committed
Change collection requirements
1 parent af036bc commit 8ad7dcb

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

vdirsyncer/storage/remotestorage.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ class RemoteStorage(Storage):
115115
def __init__(self, account, verify=True, verify_fingerprint=None,
116116
auth_cert=None, access_token=None, **kwargs):
117117
super(RemoteStorage, self).__init__(**kwargs)
118-
if not self.collection:
119-
raise ValueError('collection must not be null.')
120-
121118
self.session = Session(
122119
account=account,
123120
verify=verify,
@@ -234,6 +231,17 @@ class RemoteStorageContacts(RemoteStorage):
234231
item_mimetype = 'text/vcard'
235232
scope = 'vdir_contacts'
236233

234+
def __init__(self, **kwargs):
235+
if kwargs.get('collection'):
236+
raise ValueError(
237+
'No collections allowed for contacts, '
238+
'there is only one addressbook. '
239+
'Use the vcard groups construct to categorize your contacts '
240+
'into groups.'
241+
)
242+
243+
super(RemoteStorageContacts, self).__init__(**kwargs)
244+
237245

238246
class RemoteStorageCalendars(RemoteStorage):
239247
__doc__ = '''
@@ -244,3 +252,9 @@ class RemoteStorageCalendars(RemoteStorage):
244252
fileext = '.ics'
245253
item_mimetype = 'text/icalendar'
246254
scope = 'vdir_calendars'
255+
256+
def __init__(self, **kwargs):
257+
if not kwargs.get('collection'):
258+
raise ValueError('The collections parameter is required.')
259+
260+
super(RemoteStorageCalendars, self).__init__(**kwargs)

0 commit comments

Comments
 (0)