responsecode.NO_CONTENT) got_an_error = False if makecalendar.children: # mkcalendar -> set -> prop -> property* for property in makecalendar.children[0].children[0].children: try: if property.qname() == ( caldavxml.caldav_namespace, "supported-calendar-component-set"): yield self.setSupportedComponentSet(property) set_supported_component_set = True else: yield self.writeProperty(property, request) except HTTPError: errors.add(Failure(), property) got_an_error = True else: errors.add(responsecode.OK, property) if got_an_error: # Force a transaction error and proper clean-up errors.error() raise HTTPError(MultiStatusResponse([errors.response()])) # When calendar collections are single component only, default MKCALENDAR is VEVENT only if not set_supported_component_set and config.RestrictCalendarsToOneComponentType: yield self.setSupportedComponents(("VEVENT", )) returnValue(responsecode.CREATED)
caldavxml.caldav_namespace, "supported-calendar-component-set"): yield self.setSupportedComponentSet(property) set_supported_component_set = True elif not isinstance(property, davxml.ResourceType): yield self.writeProperty(property, request) except HTTPError: errors.add(Failure(), property) got_an_error = True else: errors.add(responsecode.OK, property) if got_an_error: # Clean up errors.error() raise HTTPError( Response(code=responsecode.FORBIDDEN, stream=mkcolxml.MakeCollectionResponse( errors.response()).toxml())) # When calendar collections are single component only, default MKCALENDAR is VEVENT only if rtype == "calendar" and not set_supported_component_set and config.RestrictCalendarsToOneComponentType: yield self.setSupportedComponents(("VEVENT", )) yield returnValue(responsecode.CREATED) else: # No request body so it is a standard MKCOL result = yield super(CalDAVResource, self).http_MKCOL(request) returnValue(result)
# all-or-nothing request. # We handle the first one here, and then re-raise to handle the # rest in the containing scope. # for action in undoActions: x = waitForDeferred(action()) yield x x.getResult() raise # # If we had an error we need to undo any changes that did succeed and change status of # those to 424 Failed Dependency. # if gotError: for action in undoActions: x = waitForDeferred(action()) yield x x.getResult() responses.error() # # Return response - use 200 if Prefer:return=minimal set and no errors # if returnMinimal and not gotError: yield responsecode.OK else: yield MultiStatusResponse([responses.response()]) http_PROPPATCH = deferredGenerator(http_PROPPATCH)
raise HTTPError(StatusResponse(responsecode.UNSUPPORTED_MEDIA_TYPE, error)) errors = PropertyStatusResponseQueue("PROPPATCH", request.uri, responsecode.NO_CONTENT) got_an_error = False if makecalendar.children: # mkcalendar -> set -> prop -> property* for property in makecalendar.children[0].children[0].children: try: if property.qname() == (caldavxml.caldav_namespace, "supported-calendar-component-set"): yield self.setSupportedComponentSet(property) set_supported_component_set = True else: yield self.writeProperty(property, request) except HTTPError: errors.add(Failure(), property) got_an_error = True else: errors.add(responsecode.OK, property) if got_an_error: # Force a transaction error and proper clean-up errors.error() raise HTTPError(MultiStatusResponse([errors.response()])) # When calendar collections are single component only, default MKCALENDAR is VEVENT only if not set_supported_component_set and config.RestrictCalendarsToOneComponentType: yield self.setSupportedComponents(("VEVENT",)) returnValue(responsecode.CREATED)
try: if rtype == "calendar" and property.qname() == (caldavxml.caldav_namespace, "supported-calendar-component-set"): yield self.setSupportedComponentSet(property) set_supported_component_set = True elif not isinstance(property, davxml.ResourceType): yield self.writeProperty(property, request) except HTTPError: errors.add(Failure(), property) got_an_error = True else: errors.add(responsecode.OK, property) if got_an_error: # Clean up errors.error() raise HTTPError(Response( code=responsecode.FORBIDDEN, stream=mkcolxml.MakeCollectionResponse(errors.response()).toxml() )) # When calendar collections are single component only, default MKCALENDAR is VEVENT only if rtype == "calendar" and not set_supported_component_set and config.RestrictCalendarsToOneComponentType: yield self.setSupportedComponents(("VEVENT",)) yield returnValue(responsecode.CREATED) else: # No request body so it is a standard MKCOL result = yield super(CalDAVResource, self).http_MKCOL(request) returnValue(result)
try: if rtype == "calendar" and property.qname() == (caldavxml.caldav_namespace, "supported-calendar-component-set"): yield self.setSupportedComponentSet(property) set_supported_component_set = True elif not isinstance(property, davxml.ResourceType): yield self.writeProperty(property, request) except HTTPError: errors.add(Failure(), property) got_an_error = True else: errors.add(responsecode.OK, property) if got_an_error: # Clean up errors.error() raise HTTPError(Response( code=responsecode.FORBIDDEN, stream=mkcolxml.MakeCollectionResponse(errors.response()).toxml() )) # When calendar collections are single component only, default MKCALENDAR is VEVENT only if rtype == "calendar" and not set_supported_component_set and config.RestrictCalendarsToOneComponentType: yield self.setSupportedComponents(("VEVENT",)) yield returnValue(responsecode.CREATED) else: # No request body so it is a standard MKCOL result = yield super(CalDAVResource, self).http_MKCOL(request) returnValue(result)