How to use the xandikos.webdav.ensure_trailing_slash 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 / sync.py View on Github external
if limit is not None:
            try:
                [nresults_el] = list(limit)
            except ValueError:
                raise webdav.BadRequestError(
                    'Invalid number of subelements in limit')
            try:
                nresults = int(nresults_el.text)
            except ValueError:
                raise webdav.BadRequestError(
                    'nresults not a number')
            diff_iter = itertools.islice(diff_iter, nresults)

        for (name, old_resource, new_resource) in diff_iter:
            subhref = urllib.parse.urljoin(
                webdav.ensure_trailing_slash(href), name)
            if new_resource is None:
                yield webdav.Status(subhref, status='404 Not Found')
            else:
                propstat = []
                for prop in requested:
                    if old_resource is not None:
                        old_propstat = webdav.get_property_from_element(
                            href, old_resource, properties, environ, prop)
                    else:
                        old_propstat = None
                    new_propstat = webdav.get_property_from_element(
                        href, new_resource, properties, environ, prop)
                    if old_propstat != new_propstat:
                        propstat.append(new_propstat)
                yield webdav.Status(subhref, propstat=propstat)
        yield SyncToken(new_token)
github jelmer / xandikos / xandikos / carddav.py View on Github external
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))
github jelmer / xandikos / xandikos / caldav.py View on Github external
async def get_value(self, base_href, resource, el, environ):
        for href in resource.get_calendar_home_set():
            href = webdav.ensure_trailing_slash(href)
            el.append(webdav.create_href(href, base_href))