Logo Search packages:      
Sourcecode: radicale version File versions  Download package

def radicale::CalendarHTTPHandler::do_PUT (   self )
Manage PUT request.

Definition at line 211 of file __init__.py.

                    :
        """Manage PUT request."""
        item_name = xmlutils.name_from_path(self.path)
        item = self._calendar.get_item(item_name)
        if (not item and not self.headers.get("If-Match")) or \
                (item and self.headers.get("If-Match", item.etag) == item.etag):
            # PUT allowed in 3 cases
            # Case 1: No item and no ETag precondition: Add new item
            # Case 2: Item and ETag precondition verified: Modify item
            # Case 3: Item and no Etag precondition: Force modifying item
            ical_request = self._decode(
                self.rfile.read(int(self.headers["Content-Length"])))
            xmlutils.put(self.path, ical_request, self._calendar)
            etag = self._calendar.get_item(item_name).etag

            self.send_response(client.CREATED)
            self.send_header("ETag", etag)
            self.end_headers()
        else:
            # PUT rejected in all other cases
            self.send_response(client.PRECONDITION_FAILED)


Generated by  Doxygen 1.6.0   Back to index