[CalendarServer-changes] [703] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Tue Dec 5 15:18:04 PST 2006


Revision: 703
          http://trac.macosforge.org/projects/calendarserver/changeset/703
Author:   wsanchez at apple.com
Date:     2006-12-05 15:18:04 -0800 (Tue, 05 Dec 2006)

Log Message:
-----------
Remove isNonCalendarCollectionParent() and isNonCollectionParent() from CalDAVResource API.
These are not general enough to warrant it.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/icaldav.py
    CalendarServer/trunk/twistedcaldav/method/mkcol.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/static.py

Modified: CalendarServer/trunk/twistedcaldav/icaldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/icaldav.py	2006-12-05 22:41:31 UTC (rev 702)
+++ CalendarServer/trunk/twistedcaldav/icaldav.py	2006-12-05 23:18:04 UTC (rev 703)
@@ -50,20 +50,6 @@
             otherwise.
         """
 
-    def isNonCalendarCollectionParent():
-        """
-        @return: True if this resource is a collection that does not allow
-            calendar collections to be created inside of it anywhere, False
-            otherwise.
-        """
-
-    def isNonCollectionParent():
-        """
-        @return: True if this resource is a collection that does not allow
-            collections to be created inside of it anywhere, False
-            otherwise.
-        """
-
     def findCalendarCollections(depth):
         """
         Returns an iterable of child calendar collection resources for the given

Modified: CalendarServer/trunk/twistedcaldav/method/mkcol.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/mkcol.py	2006-12-05 22:41:31 UTC (rev 702)
+++ CalendarServer/trunk/twistedcaldav/method/mkcol.py	2006-12-05 23:18:04 UTC (rev 703)
@@ -29,12 +29,19 @@
 from twisted.web2.http import HTTPError, StatusResponse
 
 from twistedcaldav import customxml
-from twistedcaldav.resource import isNonCollectionParentResource
 
 def http_MKCOL(self, request):
     #
     # Don't allow DAV collections in a calendar collection for now
     #
+    def isNonCollectionParentResource(resource):
+        try:
+            resource = ICalDAVResource(resource)
+        except TypeError:
+            return False
+        else:
+            return resource.isPseudoCalendarCollection() or resource.isSpecialCollection(customxml.DropBox)
+
     parent = waitForDeferred(self._checkParents(request, isNonCollectionParentResource))
     yield parent
     parent = parent.getResult()

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2006-12-05 22:41:31 UTC (rev 702)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2006-12-05 23:18:04 UTC (rev 703)
@@ -313,22 +313,6 @@
         """
         return self.isCalendarCollection()
 
-    def isNonCalendarCollectionParent(self):
-        """
-        See L{ICalDAVResource.isNonCalendarCollectionParent}.
-        """
-        
-        # Cannot create calendars inside other calendars or a drop box home
-        return self.isPseudoCalendarCollection() or self.isSpecialCollection(customxml.DropBoxHome)
-
-    def isNonCollectionParent(self):
-        """
-        See L{ICalDAVResource.isNonCalendarCollectionParent}.
-        """
-        
-        # Cannot create collections inside a drop box
-        return self.isPseudoCalendarCollection() or self.isSpecialCollection(customxml.DropBox)
-
     def findCalendarCollections(self, depth, request, callback, privileges=None):
         """
         See L{ICalDAVResource.findCalendarCollections}.
@@ -788,22 +772,6 @@
     else:
         return resource.isPseudoCalendarCollection()
 
-def isNonCalendarCollectionParentResource(resource):
-    try:
-        resource = ICalDAVResource(resource)
-    except TypeError:
-        return False
-    else:
-        return resource.isNonCalendarCollectionParent()
-
-def isNonCollectionParentResource(resource):
-    try:
-        resource = ICalDAVResource(resource)
-    except TypeError:
-        return False
-    else:
-        return resource.isNonCollectionParent()
-
 def isScheduleInboxResource(resource):
     try:
         resource = ICalendarSchedulingCollectionResource(resource)

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2006-12-05 22:41:31 UTC (rev 702)
+++ CalendarServer/trunk/twistedcaldav/static.py	2006-12-05 23:18:04 UTC (rev 703)
@@ -50,7 +50,7 @@
 from twistedcaldav.ical import Component as iComponent
 from twistedcaldav.ical import Property as iProperty
 from twistedcaldav.index import Index, IndexSchedule, db_basename
-from twistedcaldav.resource import CalDAVResource, isNonCalendarCollectionParentResource
+from twistedcaldav.resource import CalDAVResource
 from twistedcaldav.resource import ScheduleInboxResource, ScheduleOutboxResource
 from twistedcaldav.resource import isCalendarCollectionResource
 from twistedcaldav.extensions import DAVFile
@@ -100,6 +100,14 @@
     
             return self.createCalendarCollection()
             
+        def isNonCalendarCollectionParentResource(resource):
+            try:
+                resource = ICalDAVResource(resource)
+            except TypeError:
+                return False
+            else:
+                return resource.isPseudoCalendarCollection() or resource.isSpecialCollection(customxml.DropBoxHome)
+
         parent = self._checkParents(request, isNonCalendarCollectionParentResource)
         parent.addCallback(_defer)
         return parent

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061205/49b9dcf9/attachment.html


More information about the calendarserver-changes mailing list