[CalendarServer-changes] [296] CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Tue Oct 24 12:58:25 PDT 2006


Revision: 296
          http://trac.macosforge.org/projects/calendarserver/changeset/296
Author:   cdaboo at apple.com
Date:     2006-10-24 12:58:24 -0700 (Tue, 24 Oct 2006)

Log Message:
-----------
Initial drop box provisioning.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/customxml.py

Added Paths:
-----------
    CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/dropbox.py

Modified: CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/customxml.py	2006-10-24 05:07:08 UTC (rev 295)
+++ CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/customxml.py	2006-10-24 19:58:24 UTC (rev 296)
@@ -89,3 +89,26 @@
     hidden = True
 
 parser.registerElement(TwistedScheduleAutoRespond)
+
+class DropBox (davxml.WebDAVEmptyElement):
+    """
+    Denotes a drop box collection.
+    (Apple Extension to CalDAV)
+    """
+    namespace = twisted_dav_namespace
+    name = "dropbox"
+
+class Notifications (davxml.WebDAVEmptyElement):
+    """
+    Denotes a notifications collection.
+    (Apple Extension to CalDAV)
+    """
+    namespace = twisted_dav_namespace
+    name = "notifications"
+
+##
+# Extensions to davxml.ResourceType
+##
+
+davxml.ResourceType.dropbox = davxml.ResourceType(davxml.Collection(), DropBox())
+davxml.ResourceType.notifications = davxml.ResourceType(davxml.Collection(), Notifications())

Added: CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/dropbox.py
===================================================================
--- CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/dropbox.py	                        (rev 0)
+++ CalendarServer/branches/users/cdaboo/dropbox/twistedcaldav/dropbox.py	2006-10-24 19:58:24 UTC (rev 296)
@@ -0,0 +1,72 @@
+##
+# Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# DRI: Cyrus Daboo, cdaboo at apple.com
+##
+
+from twistedcaldav.customxml import davxml
+import os
+from twistedcaldav.static import CalDAVFile
+
+"""
+Implements drop-box functionality. A drop box is an external attachment store that provides
+for automatic notification of changes to subscribed users.
+"""
+
+class DropBox(object):
+    
+    # These are all options that will be set from a .plist configuration file.
+
+    enabled = True                # Whether or not drop box functionaility is enabled.
+    dropboxName = "dropbox"       # Name of the collection in which drop boxes can be created.
+    inheritedACLs = True          # Whether or not ACLs set on a drop box collection are automatically
+                                  # inherited by child resources.
+                                  
+    notifications = True          # Whether to post notification messages into per-user notification collection.
+    notifcationName = "notify"    # Name of the collection in which notifications will be stored.
+    
+    @classmethod
+    def provision(clzz, principal, cuhome):
+        """
+        Provision user account with appropriate collections for drop box
+        and notifications.
+        
+        @param principal: the L{CalendarPrincipalResource} for the principal to provision
+        @param cuhome: C{tuple} of (C{str} - URI of user calendar home, L{DAVResource} - resource of user calendar home)
+        """
+        
+        # Only if enabled
+        if not DropBox.enabled:
+            return
+        
+        # Create drop box collection in calendar-home collection resource if not already present.
+        
+        child = CalDAVFile(os.path.join(cuhome[1].fp.path, DropBox.dropboxName))
+        child_exists = child.exists()
+        if not child_exists:
+            c = child.createSpecialCollection(davxml.ResourceType.dropbox)
+            assert c.called
+            c = c.result
+        
+        if not DropBox.notifications:
+            return
+        
+        child = CalDAVFile(os.path.join(cuhome[1].fp.path, DropBox.notifcationName))
+        child_exists = child.exists()
+        if not child_exists:
+            c = child.createSpecialCollection(davxml.ResourceType.notifications)
+            assert c.called
+            c = c.result
+        
\ No newline at end of file

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061024/64ecb23e/attachment.html


More information about the calendarserver-changes mailing list