[CalendarServer-changes] [4769] CalendarServer/branches/release/CalendarServer-2.4-dev

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 18 11:51:02 PST 2009


Revision: 4769
          http://trac.macosforge.org/projects/calendarserver/changeset/4769
Author:   glyph at apple.com
Date:     2009-11-18 11:51:02 -0800 (Wed, 18 Nov 2009)
Log Message:
-----------
Pulled up r4748 from trunk.

Revision Links:
--------------
    http://trac.macosforge.org/projects/calendarserver/changeset/4748

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/test/test_upgrade.py
    CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/upgrade.py

Property Changed:
----------------
    CalendarServer/branches/release/CalendarServer-2.4-dev/


Property changes on: CalendarServer/branches/release/CalendarServer-2.4-dev
___________________________________________________________________
Modified: svn:mergeinfo
   - /CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/trunk:4439-4440,4448,4450,4464,4473-4475,4602,4711-4712,4716-4717,4758
   + /CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067
/CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075
/CalendarServer/trunk:4439-4440,4448,4450,4464,4473-4475,4602,4711-4712,4716-4717,4748,4758

Modified: CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/test/test_upgrade.py	2009-11-18 19:45:47 UTC (rev 4768)
+++ CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/test/test_upgrade.py	2009-11-18 19:51:02 UTC (rev 4769)
@@ -14,6 +14,10 @@
 # limitations under the License.
 ##
 
+
+from twisted.python.filepath import FilePath
+from twisted.web2.dav import davxml
+
 from twistedcaldav.config import config
 from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyDatabase
 from twistedcaldav.directory.xmlfile import XMLDirectoryService
@@ -22,7 +26,6 @@
 from twistedcaldav.upgrade import UpgradeError, upgradeData, updateFreeBusySet
 from twistedcaldav.test.util import TestCase
 from calendarserver.tools.util import getDirectory
-from twisted.web2.dav import davxml
 
 import hashlib
 import os, zlib, cPickle
@@ -606,14 +609,36 @@
         self.verifyDirectoryComparison(before, after, reverify=True)
 
 
-    def test_calendarsUpgradeWithDSStore(self):
+    def test_calendarsUpgradeWithUnknownFiles(self):
         """
-        Verify that .DS_Store files don't hinder an upgrade
+        Unknown files, including .DS_Store files at any point in the hierarchy,
+        as well as non-directory in a user's calendar home, will be ignored and not
+        interrupt an upgrade.
         """
 
         self.setUpXMLDirectory()
         directory = getDirectory()
 
+        ignoredUIDContents = {
+            "64" : {
+                "23" : {
+                    "6423F94A-6B76-4A3A-815B-D52CFD77935D" : {
+                        "calendar" : {
+                        },
+                        "garbage.ics" : {
+                            "@contents": "Oops, not actually an ICS file.",
+                        },
+                        "other-file.txt": {
+                            "@contents": "Also not a calendar collection."
+                        }
+                    }
+                }
+            },
+            ".DS_Store" : {
+                "@contents" : "",
+            }
+        }
+
         before = {
             ".DS_Store" :
             {
@@ -625,13 +650,7 @@
                 {
                     "@contents" : "",
                 },
-                "__uids__" :
-                {
-                    ".DS_Store" :
-                    {
-                        "@contents" : "",
-                    },
-                },
+                "__uids__" :ignoredUIDContents,
             },
             "principals" :
             {
@@ -667,13 +686,7 @@
                 {
                     "@contents" : "",
                 },
-                "__uids__" :
-                {
-                    ".DS_Store" :
-                    {
-                        "@contents" : "",
-                    },
-                },
+                "__uids__" : ignoredUIDContents,
             },
             CalendarUserProxyDatabase.dbFilename :
             {

Modified: CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/upgrade.py	2009-11-18 19:45:47 UTC (rev 4768)
+++ CalendarServer/branches/release/CalendarServer-2.4-dev/twistedcaldav/upgrade.py	2009-11-18 19:51:02 UTC (rev 4769)
@@ -1,3 +1,4 @@
+# -*- test-case-name: twistedcaldav.test.test_upgrade -*-
 ##
 # Copyright (c) 2008 Apple Inc. All rights reserved.
 #
@@ -177,6 +178,10 @@
         try:
             for cal in os.listdir(homePath):
                 calPath = os.path.join(homePath, cal)
+                if not os.path.isdir(calPath):
+                    # Skip non-directories; these might have been uploaded by a
+                    # random DAV client, they can't be calendar collections.
+                    continue
                 if cal == 'notifications':
                     # Delete the old, now obsolete, notifications directory.
                     rmdir(calPath)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091118/9552042e/attachment-0001.html>


More information about the calendarserver-changes mailing list