Code Repositories xandikos / 394c0e8
Add timezones property, feature flags. Jelmer Vernooń≥ 3 years ago
9 changed file(s) with 89 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
168168 Not supported
169169
170170 ## DAV Properties
171 - CALDAV:timezone-service-set [not suported]
171 - CALDAV:timezone-service-set [supported]
172172 - CALDAV:calendar-timezone-id [not supported]
173173
174174 # rfc5397.txt (WebDAV Current Principal Extension)
2525 from xml.etree import ElementTree as ET
2626
2727 from xandikos import webdav
28
29 # Feature to advertise access control support.
30 FEATURE = 'access-control'
2831
2932
3033 class CurrentUserPrivilegeSetProperty(webdav.Property):
4646 CALENDAR_RESOURCE_TYPE = '{urn:ietf:params:xml:ns:caldav}calendar'
4747
4848 NAMESPACE = 'urn:ietf:params:xml:ns:caldav'
49
50 # Feature to advertise to indicate CalDAV support.
51 FEATURE = 'calendar-access'
4952
5053
5154 class Calendar(webdav.Collection):
3030 NAMESPACE = 'urn:ietf:params:xml:ns:carddav'
3131 ADDRESSBOOK_RESOURCE_TYPE = '{%s}addressbook' % NAMESPACE
3232
33 # Feature to advertise presence of CardDAV support
34 FEATURE = 'addressbook'
35
3336
3437 class AddressbookHomeSetProperty(webdav.Property):
3538 """addressbook-home-set property
2828
2929
3030 SCHEDULE_INBOX_RESOURCE_TYPE = '{%s}schedule-inbox' % caldav.NAMESPACE
31
32 # Feature to advertise to indicate scheduling support.
33 FEATURE = 'calendar-auto-schedule'
3134
3235
3336 class ScheduleInbox(caldav.Calendar):
2424 'caldav',
2525 'store',
2626 'webdav',
27 'web',
2728 ]
2829 module_names = ['xandikos.tests.test_' + name for name in names]
2930 loader = unittest.TestLoader()
0 # Xandikos
1 # Copyright (C) 2016 Jelmer Vernooij <jelmer@jelmer.uk>
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; version 2
6 # of the License or (at your option) any later version of
7 # the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 # MA 02110-1301, USA.
18
19 import unittest
20
21 from xandikos import web
0 # Xandikos
1 # Copyright (C) 2016 Jelmer Vernooij <jelmer@jelmer.uk>
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; version 2
6 # of the License or (at your option) any later version of
7 # the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 # MA 02110-1301, USA.
18
19 """Timezone handling.
20
21 See http://www.webdav.org/specs/rfc7809.html
22 """
23
24 from defusedxml.ElementTree import fromstring as xmlparse
25 from xml.etree import ElementTree as ET
26
27 from xandikos import caldav, webdav
28
29
30 class TimezoneServiceSetProperty(webdav.Property):
31 """timezone-service-set property
32
33 See http://www.webdav.org/specs/rfc7809.html, section 5.1
34 """
35
36 name = '{DAV:}timezone-service-set'
37 # Should be set on CalDAV calendar home collection resources,
38 # but Xandikos doesn't have a separate resource type for those.
39 resource_type = webdav.COLLECTION_RESOURCE_TYPE
40 in_allprops = False
41 protected = True
42 live = True
43
44 def __init__(self, timezone_services):
45 super(TimezoneServiceSetProperty, self).__init__(self)
46 self._timezone_services = timezone_services
47
48 def get_value(self, resource, el):
49 for timezone_service_href in self._timezone_services:
50 el.append(webdav.create_href_element(timezone_service_href))
2929 import posixpath
3030 import uuid
3131
32 from xandikos import access, caldav, carddav, sync, webdav, infit, scheduling
32 from xandikos import access, caldav, carddav, sync, webdav, infit, scheduling, timezones
3333 from xandikos.store import (
3434 BareGitStore,
3535 GitStore,
533533 scheduling.ScheduleOutboxURLProperty(),
534534 scheduling.CalendarUserTypeProperty(),
535535 webdav.GetLastModifiedProperty(),
536 timezones.TimezoneServiceSetProperty([]),
536537 ])
537538 self.register_reporters([
538539 caldav.CalendarMultiGetReporter(),