except KeyError, e: # Removing a non-existent property is OK according to WebDAV if removing: responses.add(responsecode.OK, property) yield True return else: # Convert KeyError exception into HTTPError responses.add( Failure(exc_value=HTTPError(StatusResponse(responsecode.FORBIDDEN, str(e)))), property ) yield False return except: responses.add(Failure(), property) yield False return else: responses.add(responsecode.OK, property) # Only add undo action for those that succeed because those that fail will not have changed undoActions.append(undo) yield True return do = deferredGenerator(do) if isinstance(setOrRemove, davxml.Set): for property in properties:
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)
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)