def do_PROPPATCH(self, environ, base_prefix, path, user): """Manage PROPPATCH request.""" if not self.Rights.authorized(user, path, "w"): return NOT_ALLOWED try: xml_content = self._read_xml_content(environ) except RuntimeError as e: self.logger.warning("Bad PROPPATCH request on %r: %s", path, e, exc_info=True) return BAD_REQUEST except socket.timeout: self.logger.debug("client timed out", exc_info=True) return REQUEST_TIMEOUT item = next(self.Collection.discover(path), None) if not item: return NOT_FOUND if not isinstance(item, storage.BaseCollection): return FORBIDDEN headers = { "DAV": DAV_HEADERS, "Content-Type": "text/xml; charset=%s" % self.encoding } try: xml_answer = xmlutils.proppatch(base_prefix, path, xml_content, item) except ValueError as e: self.logger.warning("Bad PROPPATCH request on %r: %s", path, e, exc_info=True) return BAD_REQUEST return (client.MULTI_STATUS, headers, self._write_xml_content(xml_answer))
def do_PROPPATCH(self, environ, base_prefix, path, user): """Manage PROPPATCH request.""" if not self.Rights.authorized(user, path, "w"): return NOT_ALLOWED try: xml_content = self._read_xml_content(environ) except RuntimeError as e: self.logger.warning( "Bad PROPPATCH request on %r: %s", path, e, exc_info=True) return BAD_REQUEST except socket.timeout as e: self.logger.debug("client timed out", exc_info=True) return REQUEST_TIMEOUT with self.Collection.acquire_lock("w", user): item = next(self.Collection.discover(path), None) if not isinstance(item, storage.BaseCollection): return WEBDAV_PRECONDITION_FAILED headers = {"DAV": DAV_HEADERS, "Content-Type": "text/xml; charset=%s" % self.encoding} try: xml_answer = xmlutils.proppatch(base_prefix, path, xml_content, item) except ValueError as e: self.logger.warning( "Bad PROPPATCH request on %r: %s", path, e, exc_info=True) return BAD_REQUEST return (client.MULTI_STATUS, headers, self._write_xml_content(xml_answer))
def proppatch(self, environ, collections, content, user): """Manage PROPPATCH request.""" collection = collections[0] answer = xmlutils.proppatch(environ["PATH_INFO"], content, collection) headers = { "DAV": "1, 2, 3, calendar-access, addressbook, extended-mkcol", "Content-Type": "text/xml"} return client.MULTI_STATUS, headers, answer
def proppatch(self, environ, calendars, content, user): """Manage PROPPATCH request.""" calendar = calendars[0] answer = xmlutils.proppatch(environ["PATH_INFO"], content, calendar) headers = { "DAV": "1, calendar-access", "Content-Type": "text/xml"} return client.MULTI_STATUS, headers, answer
def proppatch(self, environ, collections, content, user): """Manage PROPPATCH request.""" collection = collections[0] answer = xmlutils.proppatch(environ["PATH_INFO"], content, collection) headers = { "DAV": "1, 2, 3, calendar-access, addressbook, extended-mkcol", "Content-Type": "text/xml" } return client.MULTI_STATUS, headers, answer
def do_PROPPATCH(self, environ, read_collections, write_collections, content, user): """Manage PROPPATCH request.""" _logger.info('do_PROPPATCH %s %s' % (content, user)) if not len(write_collections): return NOT_ALLOWED collection = write_collections[0] answer = xmlutils.proppatch(environ["PATH_INFO"], content, collection) headers = { "DAV": "1, 2, 3, calendar-access, addressbook, extended-mkcol", "Content-Type": "text/xml" } return client.MULTI_STATUS, headers, answer