[CalendarServer-changes] [833] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu Dec 14 20:48:49 PST 2006
Revision: 833
http://trac.macosforge.org/projects/calendarserver/changeset/833
Author: cdaboo at apple.com
Date: 2006-12-14 20:48:48 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
Fix up drop box support after recent changes. Note that notifications are not working right now. Also,
we need to make sure the drop box properties are not advertised if drop box is disabled.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/calendar.py
CalendarServer/trunk/twistedcaldav/dropbox.py
CalendarServer/trunk/twistedcaldav/static.py
Modified: CalendarServer/trunk/twistedcaldav/directory/calendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendar.py 2006-12-15 03:45:52 UTC (rev 832)
+++ CalendarServer/trunk/twistedcaldav/directory/calendar.py 2006-12-15 04:48:48 UTC (rev 833)
@@ -31,6 +31,8 @@
from twisted.web2.dav.resource import TwistedACLInheritable, TwistedQuotaRootProperty
from twistedcaldav import caldavxml
+from twistedcaldav.config import config
+from twistedcaldav.dropbox import DropBoxHomeResource
from twistedcaldav.extensions import ReadOnlyResourceMixIn, DAVResource
from twistedcaldav.resource import CalDAVResource
from twistedcaldav.schedule import ScheduleInboxResource, ScheduleOutboxResource
@@ -181,17 +183,35 @@
self._parent = parent
# Cache children which must be of a specific type
- for name, cls in (
+ childlist = (
("inbox" , ScheduleInboxResource ),
("outbox", ScheduleOutboxResource),
- ):
+ )
+ if config.DropBoxEnabled:
+ childlist = childlist + (
+ ("dropbox", DropBoxHomeResource),
+ #("notifications": NotificationsHomeResource),
+ )
+ for name, cls in childlist:
child = self.provisionChild(name)
assert isinstance(child, cls), "Child %r is not a %s: %r" % (name, cls.__name__, child)
self.putChild(name, child)
def provision(self):
+ self.provisionSpecialCollections()
return self.provisionDefaultCalendars()
+ def provisionSpecialCollections(self):
+ childlist = ("inbox" , "outbox",)
+ if config.DropBoxEnabled:
+ childlist = childlist + (
+ "dropbox",
+ #"notifications",
+ )
+ for child in childlist:
+ collection = self.getChild(child)
+ collection.provision()
+
def provisionDefaultCalendars(self):
# Create a calendar collection
@@ -214,7 +234,6 @@
# Set calendar-free-busy-set on inbox
inbox = self.getChild("inbox")
- inbox.provision()
inbox.writeDeadProperty(caldavxml.CalendarFreeBusySet(davxml.HRef(childURL)))
d = child.createCalendarCollection()
Modified: CalendarServer/trunk/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dropbox.py 2006-12-15 03:45:52 UTC (rev 832)
+++ CalendarServer/trunk/twistedcaldav/dropbox.py 2006-12-15 04:48:48 UTC (rev 833)
@@ -42,10 +42,7 @@
Drop box collection resource.
"""
def resourceType(self):
- return davxml.ResourceType(
- davxml.ResourceType.collection,
- davxml.ResourceType.dropboxhome,
- )
+ return davxml.ResourceType.dropboxhome
def isCollection(self):
return True
@@ -55,14 +52,8 @@
Drop box resource.
"""
def resourceType(self):
- return davxml.ResourceType(
- davxml.ResourceType.collection,
- davxml.ResourceType.dropbox,
- )
+ return davxml.ResourceType.dropbox
- def isCollection(self):
- return True
-
def writeNewACEs(self, newaces):
"""
Write a new ACL to the resource's property store. We override this for calendar collections
@@ -113,6 +104,12 @@
(calendarserver_namespace, "valid-drop-box")
)
+ def http_MKCALENDAR (self, request):
+ return ErrorResponse(
+ responsecode.FORBIDDEN,
+ (calendarserver_namespace, "valid-drop-box")
+ )
+
def http_X_APPLE_SUBSCRIBE(self, request):
d = waitForDeferred(self.authorize(request, (davxml.Read(),)))
yield d
@@ -171,7 +168,15 @@
class DropBoxChildResource (DAVResource):
def http_MKCOL(self, request):
- return responsecode.FORBIDDEN
+ return ErrorResponse(
+ responsecode.FORBIDDEN,
+ (calendarserver_namespace, "valid-drop-box-resource")
+ )
+ def http_MKCALENDAR (self, request):
+ return ErrorResponse(
+ responsecode.FORBIDDEN,
+ (calendarserver_namespace, "valid-drop-box-resource")
+ )
def http_PUT(self, request):
#
Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py 2006-12-15 03:45:52 UTC (rev 832)
+++ CalendarServer/trunk/twistedcaldav/static.py 2006-12-15 04:48:48 UTC (rev 833)
@@ -548,12 +548,18 @@
else:
return DropBoxChildFile(path, self)
+ http_DELETE = DropBoxCollectionResource.http_DELETE
+ http_PUT = DropBoxCollectionResource.http_PUT
+ http_MKCALENDAR = DropBoxCollectionResource.http_MKCALENDAR
+ http_X_APPLE_SUBSCRIBE = DropBoxCollectionResource.http_X_APPLE_SUBSCRIBE
+ http_X_APPLE_UNSUBSCRIBE = DropBoxCollectionResource.http_X_APPLE_SUBSCRIBE
+
class DropBoxChildFile (DropBoxChildResource, CalDAVFile):
def __init__(self, path, parent):
DropBoxChildResource.__init__(self)
CalDAVFile.__init__(self, path, principalCollections=parent.principalCollections())
- assert self.fp.isfile() or not self.fp.exists
+ assert self.fp.isfile() or not self.fp.exists()
def createSimilarFile(self, path):
if path == self.fp.path:
@@ -561,6 +567,10 @@
else:
return responsecode.NOT_FOUND
+ http_MKCOL = DropBoxChildResource.http_MKCOL
+ http_MKCALENDAR = DropBoxChildResource.http_MKCALENDAR
+ http_PUT = DropBoxChildResource.http_PUT
+
##
# Utilities
##
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061214/74eee738/attachment.html
More information about the calendarserver-changes
mailing list