[CalendarServer-changes] [248] CalendarServer/trunk/twistedcaldav/static.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 18:01:13 PDT 2006


Revision: 248
          http://trac.macosforge.org/projects/calendarserver/changeset/248
Author:   wsanchez at apple.com
Date:     2006-10-04 18:01:13 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Avoid case variant name conflicts for put children (eg. inbox and outbox) of CalendarHomeFile.
Fixes #13

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/static.py

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2006-10-05 00:57:02 UTC (rev 247)
+++ CalendarServer/trunk/twistedcaldav/static.py	2006-10-05 01:01:13 UTC (rev 248)
@@ -599,6 +599,26 @@
             if not child_fp.exists(): child_fp.makedirs()
             self.putChild(name, clazz(child_fp.path))
 
+    def locateChild(self, req, segments):
+        """
+        This implementation tries fails to find children we don't already know
+        about.
+        """
+        # If getChild() finds a child resource, return it
+        child = self.getChild(segments[0])
+        if child is not None:
+            return (child, segments[1:])
+
+        # Otherwise, there is no child
+        return (None, ())
+
+    def getChild(self, name):
+        # This avoids finding case variants of put children on case-insensitive filesystems.
+        if name not in self.putChildren and name.lower() in (x.lower() for x in self.putChildren):
+            return None
+
+        return super(CalendarHomeFile, self).getChild(name)
+
     def createSimilarFile(self, path):
         return CalDAVFile(path)
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061004/22e04d28/attachment.html


More information about the calendarserver-changes mailing list