Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
elif tag.tag == ('{%s}expand' % NAMESPACE):
# TODO(jelmer): https://github.com/jelmer/xandikos/issues/102
raise NotImplementedError('expand is not yet implemented')
elif tag.tag == ('{%s}limit-recurrence-set' % NAMESPACE):
# TODO(jelmer): https://github.com/jelmer/xandikos/issues/103
raise NotImplementedError(
'limit-recurrence-set is not yet implemented')
elif tag.tag == ('{%s}limit-freebusy-set' % NAMESPACE):
# TODO(jelmer): https://github.com/jelmer/xandikos/issues/104
raise NotImplementedError(
'limit-freebusy-set is not yet implemented')
else:
raise AssertionError('invalid element %r' % tag)
class CalendarDataProperty(davcommon.SubbedProperty):
"""calendar-data property
See https://tools.ietf.org/html/rfc4791, section 5.2.4
Note that this is not technically a DAV property, and
it is thus not registered in the regular webdav server.
"""
name = '{%s}calendar-data' % NAMESPACE
def supported_on(self, resource):
return (resource.get_content_type() == 'text/calendar')
async def get_value_ext(self, base_href, resource, el, environ, requested):
if len(requested) == 0:
serialized_cal = b''.join(await resource.get_body())
See https://tools.ietf.org/html/rfc6352, section 7.1.1
"""
name = '{%s}addressbook-home-set' % NAMESPACE
resource_type = '{DAV:}principal'
in_allprops = False
live = True
async def get_value(self, base_href, resource, el, environ):
for href in resource.get_addressbook_home_set():
href = webdav.ensure_trailing_slash(href)
el.append(webdav.create_href(href, base_href))
class AddressDataProperty(davcommon.SubbedProperty):
"""address-data property
See https://tools.ietf.org/html/rfc6352, section 10.4
Note that this is not technically a DAV property, and
it is thus not registered in the regular webdav server.
"""
name = '{%s}address-data' % NAMESPACE
def supported_on(self, resource):
return (resource.get_content_type() == 'text/vcard')
async def get_value_ext(self, href, resource, el, environ, requested):
# TODO(jelmer): Support subproperties
# TODO(jelmer): Don't hardcode encoding
"""Provides calendar-description property.
https://tools.ietf.org/html/rfc6352, section 6.2.1
"""
name = '{%s}addressbook-description' % NAMESPACE
resource_type = ADDRESSBOOK_RESOURCE_TYPE
async def get_value(self, href, resource, el, environ):
el.text = resource.get_addressbook_description()
def set_value(self, href, resource, el):
resource.set_addressbook_description(el.text)
class AddressbookMultiGetReporter(davcommon.MultiGetReporter):
name = '{%s}addressbook-multiget' % NAMESPACE
resource_type = ADDRESSBOOK_RESOURCE_TYPE
data_property = AddressDataProperty()
class Addressbook(webdav.Collection):
resource_types = (
webdav.Collection.resource_types + [ADDRESSBOOK_RESOURCE_TYPE])
def get_addressbook_description(self):
raise NotImplementedError(self.get_addressbook_description)
def set_addressbook_description(self, description):
raise NotImplementedError(self.set_addressbook_description)
class CalendarOrderProperty(webdav.Property):
"""Provides calendar-order property.
"""
name = '{http://apple.com/ns/ical/}calendar-order'
resource_type = CALENDAR_RESOURCE_TYPE
async def get_value(self, base_href, resource, el, environ):
el.text = resource.get_calendar_order()
async def set_value(self, href, resource, el):
resource.set_calendar_order(el.text)
class CalendarMultiGetReporter(davcommon.MultiGetReporter):
name = '{%s}calendar-multiget' % NAMESPACE
resource_type = (CALENDAR_RESOURCE_TYPE, SCHEDULE_INBOX_RESOURCE_TYPE)
data_property = CalendarDataProperty()
def parse_prop_filter(el, cls):
name = el.get('name')
# From https://tools.ietf.org/html/rfc4791, 9.7.2:
# A CALDAV:comp-filter is said to match if:
prop_filter = cls(name=name)
for subel in el:
if subel.tag == '{urn:ietf:params:xml:ns:caldav}is-not-defined':