def do_REPORT(self, environ, base_prefix, path, user): """Manage REPORT request.""" if not self._access(user, path, "r"): return NOT_ALLOWED try: xml_content = self._read_xml_content(environ) except RuntimeError as e: self.logger.warning("Bad REPORT 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 self._access(user, path, "r", item): return NOT_ALLOWED if not item: return NOT_FOUND if isinstance(item, storage.BaseCollection): collection = item else: collection = item.collection headers = {"Content-Type": "text/xml; charset=%s" % self.encoding} try: status, xml_answer = xmlutils.report(base_prefix, path, xml_content, collection) except ValueError as e: self.logger.warning("Bad REPORT request on %r: %s", path, e, exc_info=True) return BAD_REQUEST return (status, headers, self._write_xml_content(xml_answer))
def report(self, environ, calendars, content, user): """Manage REPORT request.""" # TODO: support multiple calendars here calendar = calendars[0] headers = {'Content-Type': 'text/xml'} answer = xmlutils.report(environ["PATH_INFO"], content, calendar) return client.MULTI_STATUS, headers, answer
def do_REPORT(self, environ, read_collections, write_collections, content, user): """Manage REPORT request.""" _logger.info('do_REPORT %s %s' % (content, user)) if not len(read_collections): return NOT_ALLOWED collection = read_collections[0] headers = {"Content-Type": "text/xml"} answer = xmlutils.report(environ["PATH_INFO"], content, collection) return client.MULTI_STATUS, headers, answer if partner: #~ raise Warning("Public successfull %s" % partner.get_ics_calendar(type='public').to_ical()) #~ return partner.get_ics_calendar(type='public').to_ical() document = partner.sudo().get_ics_calendar( type='freebusy').to_ical() return request.make_response( document, headers=[ ('Content-Disposition', 'attachment; filename="freebusy.ifb"'), ('Content-Type', 'text/calendar'), ('Content-Length', len(document)), ]) else: raise Warning() pass # Some error page
def do_REPORT(self, environ, base_prefix, path, user): """Manage REPORT request.""" if not self._access(user, path, "r"): return NOT_ALLOWED try: xml_content = self._read_xml_content(environ) except RuntimeError as e: self.logger.warning( "Bad REPORT 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("r", user): item = next(self.Collection.discover(path), None) if not self._access(user, path, "r", item): return NOT_ALLOWED if not item: return NOT_FOUND if isinstance(item, storage.BaseCollection): collection = item else: collection = item.collection headers = {"Content-Type": "text/xml; charset=%s" % self.encoding} try: status, xml_answer = xmlutils.report( base_prefix, path, xml_content, collection) except ValueError as e: self.logger.warning( "Bad REPORT request on %r: %s", path, e, exc_info=True) return BAD_REQUEST return (status, headers, self._write_xml_content(xml_answer))
def report(self, environ, read_collections, write_collections, content, user): """Manage REPORT request.""" if not len(read_collections): return NOT_ALLOWED collection = read_collections[0] headers = {"Content-Type": "text/xml"} answer = xmlutils.report(environ["PATH_INFO"], content, collection) return client.MULTI_STATUS, headers, answer
def report(self, environ, collections, content, user): """Manage REPORT request.""" collection = collections[0] headers = {"Content-Type": "text/xml"} answer = xmlutils.report(environ["PATH_INFO"], content, collection) return client.MULTI_STATUS, headers, answer
def report(self, environ, collections, content, user): """Manage REPORT request.""" collection = collections[0] headers = {'Content-Type': 'text/xml'} answer = xmlutils.report(environ["PATH_INFO"], content, collection) return client.MULTI_STATUS, headers, answer