How to use the xandikos.webdav.Collection function in xandikos

To help you get started, we’ve selected a few xandikos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jelmer / xandikos / xandikos / scheduling.py View on Github external
def get_max_resource_size(self):
        """Return max resource size."""
        raise NotImplementedError(self.get_max_resource_size)

    def get_schedule_default_calendar_url(self):
        """Return default calendar URL.

        None indicates there is no default URL.
        """
        return None


class ScheduleOutbox(webdav.Collection):

    resource_types = (webdav.Collection.resource_types +
                      [SCHEDULE_OUTBOX_RESOURCE_TYPE])

    def get_supported_calendar_components(self):
        """Return set of supported calendar components in this calendar.

        :return: iterable over component names
        """
        raise NotImplementedError(self.get_supported_calendar_components)

    def get_supported_calendar_data_types(self):
        """Return supported calendar data types.

        :return: iterable over (content_type, version) tuples
        """
        raise NotImplementedError(self.get_supported_calendar_data_types)
github jelmer / xandikos / xandikos / scheduling.py View on Github external
CALENDAR_USER_TYPE_GROUP = "GROUP"  # A group of individuals
CALENDAR_USER_TYPE_RESOURCE = "RESOURCE"  # A physical resource
CALENDAR_USER_TYPE_ROOM = "ROOM"  # A room resource
CALENDAR_USER_TYPE_UNKNOWN = "UNKNOWN"  # Otherwise not known

CALENDAR_USER_TYPES = (
    CALENDAR_USER_TYPE_INDIVIDUAL,
    CALENDAR_USER_TYPE_GROUP,
    CALENDAR_USER_TYPE_RESOURCE,
    CALENDAR_USER_TYPE_ROOM,
    CALENDAR_USER_TYPE_UNKNOWN)


class ScheduleInbox(webdav.Collection):

    resource_types = (webdav.Collection.resource_types +
                      [SCHEDULE_INBOX_RESOURCE_TYPE])

    def get_calendar_user_type(self):
        # Default, per section 2.4.2
        return CALENDAR_USER_TYPE_INDIVIDUAL

    def get_calendar_timezone(self):
        """Return calendar timezone.

        This should be an iCalendar object with exactly one
        VTIMEZONE component.
        """
        raise NotImplementedError(self.get_calendar_timezone)

    def set_calendar_timezone(self):
        """Set calendar timezone.
github jelmer / xandikos / xandikos / scheduling.py View on Github external
CALENDAR_USER_TYPE_INDIVIDUAL = "INDIVIDUAL"  # An individual
CALENDAR_USER_TYPE_GROUP = "GROUP"  # A group of individuals
CALENDAR_USER_TYPE_RESOURCE = "RESOURCE"  # A physical resource
CALENDAR_USER_TYPE_ROOM = "ROOM"  # A room resource
CALENDAR_USER_TYPE_UNKNOWN = "UNKNOWN"  # Otherwise not known

CALENDAR_USER_TYPES = (
    CALENDAR_USER_TYPE_INDIVIDUAL,
    CALENDAR_USER_TYPE_GROUP,
    CALENDAR_USER_TYPE_RESOURCE,
    CALENDAR_USER_TYPE_ROOM,
    CALENDAR_USER_TYPE_UNKNOWN)


class ScheduleInbox(webdav.Collection):

    resource_types = (webdav.Collection.resource_types +
                      [SCHEDULE_INBOX_RESOURCE_TYPE])

    def get_calendar_user_type(self):
        # Default, per section 2.4.2
        return CALENDAR_USER_TYPE_INDIVIDUAL

    def get_calendar_timezone(self):
        """Return calendar timezone.

        This should be an iCalendar object with exactly one
        VTIMEZONE component.
        """
        raise NotImplementedError(self.get_calendar_timezone)
github jelmer / xandikos / xandikos / caldav.py View on Github external
CALENDAR_RESOURCE_TYPE = '{%s}calendar' % NAMESPACE

SUBSCRIPTION_RESOURCE_TYPE = '{http://calendarserver.org/ns/}subscribed'

# TODO(jelmer): These resource types belong in scheduling.py
SCHEDULE_INBOX_RESOURCE_TYPE = '{%s}schedule-inbox' % NAMESPACE
SCHEDULE_OUTBOX_RESOURCE_TYPE = '{%s}schedule-outbox' % NAMESPACE

# Feature to advertise to indicate CalDAV support.
FEATURE = 'calendar-access'

TRANSPARENCY_TRANSPARENT = 'transparent'
TRANSPARENCY_OPAQUE = 'opaque'


class Calendar(webdav.Collection):

    resource_types = (webdav.Collection.resource_types +
                      [CALENDAR_RESOURCE_TYPE])

    def get_calendar_description(self) -> str:
        """Return the calendar description."""
        raise NotImplementedError(self.get_calendar_description)

    def get_calendar_color(self) -> str:
        """Return the calendar color."""
        raise NotImplementedError(self.get_calendar_color)

    def set_calendar_color(self, color: str) -> None:
        """Set the calendar color."""
        raise NotImplementedError(self.set_calendar_color)
github jelmer / xandikos / xandikos / caldav.py View on Github external
SUBSCRIPTION_RESOURCE_TYPE = '{http://calendarserver.org/ns/}subscribed'

# TODO(jelmer): These resource types belong in scheduling.py
SCHEDULE_INBOX_RESOURCE_TYPE = '{%s}schedule-inbox' % NAMESPACE
SCHEDULE_OUTBOX_RESOURCE_TYPE = '{%s}schedule-outbox' % NAMESPACE

# Feature to advertise to indicate CalDAV support.
FEATURE = 'calendar-access'

TRANSPARENCY_TRANSPARENT = 'transparent'
TRANSPARENCY_OPAQUE = 'opaque'


class Calendar(webdav.Collection):

    resource_types = (webdav.Collection.resource_types +
                      [CALENDAR_RESOURCE_TYPE])

    def get_calendar_description(self) -> str:
        """Return the calendar description."""
        raise NotImplementedError(self.get_calendar_description)

    def get_calendar_color(self) -> str:
        """Return the calendar color."""
        raise NotImplementedError(self.get_calendar_color)

    def set_calendar_color(self, color: str) -> None:
        """Set the calendar color."""
        raise NotImplementedError(self.set_calendar_color)

    def get_calendar_order(self) -> str:
        """Return the calendar order."""
github jelmer / xandikos / xandikos / scheduling.py View on Github external
"""
        raise NotImplementedError(self.get_max_attendees_per_instance)

    def get_max_resource_size(self):
        """Return max resource size."""
        raise NotImplementedError(self.get_max_resource_size)

    def get_schedule_default_calendar_url(self):
        """Return default calendar URL.

        None indicates there is no default URL.
        """
        return None


class ScheduleOutbox(webdav.Collection):

    resource_types = (webdav.Collection.resource_types +
                      [SCHEDULE_OUTBOX_RESOURCE_TYPE])

    def get_supported_calendar_components(self):
        """Return set of supported calendar components in this calendar.

        :return: iterable over component names
        """
        raise NotImplementedError(self.get_supported_calendar_components)

    def get_supported_calendar_data_types(self):
        """Return supported calendar data types.

        :return: iterable over (content_type, version) tuples
        """
github jelmer / xandikos / xandikos / carddav.py View on Github external
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)

    def get_addressbook_color(self):
        raise NotImplementedError(self.get_addressbook_color)

    def set_addressbook_color(self, color):
        raise NotImplementedError(self.set_addressbook_color)

    def get_supported_address_data_types(self):
        """Get list of supported data types.
github jelmer / xandikos / xandikos / carddav.py View on Github external
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)

    def get_addressbook_color(self):
        raise NotImplementedError(self.get_addressbook_color)

    def set_addressbook_color(self, color):
        raise NotImplementedError(self.set_addressbook_color)
github jelmer / xandikos / xandikos / caldav.py View on Github external
def calendar_query(self, create_filter_fn):
        """Query for all the members of this calendar that match `filter`.

        This is a naive implementation; subclasses should ideally provide
        their own implementation that is faster.

        :param create_filter_fn: Callback that constructs a
            filter; takes a filter building class.
        :return: Iterator over name, resource objects
        """
        raise NotImplementedError(self.calendar_query)


class Subscription(object):

    resource_types = (webdav.Collection.resource_types +
                      [SUBSCRIPTION_RESOURCE_TYPE])

    def get_source_url(self):
        """Get the source URL for this calendar."""
        raise NotImplementedError(self.get_source_url)

    def set_source_url(self, url):
        """Set the source URL for this calendar."""
        raise NotImplementedError(self.set_source_url)

    def get_calendar_description(self):
        """Return the calendar description."""
        raise NotImplementedError(self.get_calendar_description)

    def get_calendar_color(self):
        """Return the calendar color."""