Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Raise exceptions when calendar creation fails rather than return erro…
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrusdaboo committed Aug 30, 2006
1 parent 080680f commit 6268ab8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions twistedcaldav/static.py
Expand Up @@ -138,11 +138,11 @@ def createCalendar(self, request):

if self.fp.exists():
log.err("Attempt to create collection where file exists: %s" % (self.fp.path,))
return fail(responsecode.NOT_ALLOWED)
raise HTTPError(StatusResponse(responsecode.NOT_ALLOWED, "File exists"))

if not os.path.isdir(os.path.dirname(self.fp.path)):
log.err("Attempt to create collection with no parent: %s" % (self.fp.path,))
return succeed(StatusResponse(responsecode.CONFLICT, "No parent collection"))
raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))

#
# Verify that no parent collection is a calendar also
Expand All @@ -152,10 +152,10 @@ def createCalendar(self, request):
def _defer(parent):
if parent is not None:
log.err("Cannot create a calendar collection within a calendar collection %s" % (parent,))
return ErrorResponse(
raise HTTPError(ErrorResponse(
responsecode.FORBIDDEN,
(caldavxml.caldav_namespace, "calendar-collection-location-ok")
)
))

return self.createCalendarCollection()

Expand Down

0 comments on commit 6268ab8

Please sign in to comment.