Code Repositories xandikos / 7474629
Add inbox in glue. Jelmer Vernooij a month ago
1 changed file(s) with 30 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
4444 STORE_TYPE_ADDRESSBOOK,
4545 STORE_TYPE_CALENDAR,
4646 STORE_TYPE_PRINCIPAL,
47 STORE_TYPE_SCHEDULE_INBOX,
48 STORE_TYPE_SCHEDULE_OUTBOX,
4749 STORE_TYPE_OTHER,
4850 )
4951 from xandikos.store.git import (
208210 self.store.set_type(STORE_TYPE_ADDRESSBOOK)
209211 elif resource_types == {webdav.PRINCIPAL_RESOURCE_TYPE}:
210212 self.store.set_type(STORE_TYPE_PRINCIPAL)
213 elif resource_types == {caldav.SCHEDULE_INBOX_RESOURCE_TYPE,
214 webdav.COLLECTION_RESOURCE_TYPE}:
215 self.store.set_type(STORE_TYPE_SCHEDULE_INBOX)
216 elif resource_types == {caldav.SCHEDULE_OUTBOX_RESOURCE_TYPE,
217 webdav.COLLECTION_RESOURCE_TYPE}:
218 self.store.set_type(STORE_TYPE_SCHEDULE_OUTBOX)
211219 elif resource_types == {webdav.COLLECTION_RESOURCE_TYPE}:
212220 self.store.set_type(STORE_TYPE_OTHER)
213221 else:
358366 """A generic WebDAV collection."""
359367
360368
369 class ScheduleInbox(StoreBasedCollection, scheduling.ScheduleInbox):
370 """A schedling inbox collection."""
371
372
373 class ScheduleOutbox(StoreBasedCollection, scheduling.ScheduleOutbox):
374 """A schedling outbox collection."""
375
376
361377 class CalendarCollection(StoreBasedCollection, caldav.Calendar):
362378
363379 def get_calendar_description(self):
667683 raise KeyError
668684
669685 def get_schedule_inbox_url(self):
670 raise KeyError
686 # TODO(jelmer): make this configurable
687 return 'inbox'
671688
672689
673690 class PrincipalBare(CollectionSetResource, Principal):
759776 STORE_TYPE_CALENDAR: CalendarCollection,
760777 STORE_TYPE_ADDRESSBOOK: AddressbookCollection,
761778 STORE_TYPE_PRINCIPAL: PrincipalCollection,
779 STORE_TYPE_SCHEDULE_INBOX: ScheduleInbox,
780 STORE_TYPE_SCHEDULE_OUTBOX: ScheduleOutbox,
762781 STORE_TYPE_OTHER: Collection
763782 }[store.get_type()](self, relpath, store)
764783 else:
895914 else:
896915 resource.store.set_type(STORE_TYPE_ADDRESSBOOK)
897916 logging.info('Create addressbook in %s.', resource.store.path)
917 calendar_path = posixpath.join(principal.relpath,
918 principal.get_schedule_inbox_url())
919 try:
920 resource = backend.create_collection(calendar_path)
921 except FileExistsError:
922 pass
923 else:
924 resource.store.set_type(STORE_TYPE_SCHEDULE_INBOX)
925 logging.info('Create inbox in %s.', resource.store.path)
926
898927
899928
900929 def main(argv):