[CalendarServer-changes] [15571] CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py

source_changes at macosforge.org source_changes at macosforge.org
Tue May 3 06:48:29 PDT 2016


Revision: 15571
          http://trac.calendarserver.org//changeset/15571
Author:   cdaboo at apple.com
Date:     2016-05-03 06:48:29 -0700 (Tue, 03 May 2016)
Log Message:
-----------
Avoid file store import unless actually needed.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py

Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py	2016-05-02 21:17:48 UTC (rev 15570)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py	2016-05-03 13:48:29 UTC (rev 15571)
@@ -41,7 +41,6 @@
 from txdav.caldav.datastore.util import fixOneCalendarObject
 from txdav.caldav.datastore.util import migrateHome as migrateCalendarHome
 from txdav.carddav.datastore.util import migrateHome as migrateAddressbookHome
-from txdav.common.datastore.file import CommonDataStore as FileStore, TOPPATHS
 from txdav.common.datastore.sql import EADDRESSBOOKTYPE, ECALENDARTYPE
 
 from txdav.common.datastore.upgrade.sql.upgrades.calendar_upgrade_from_1_to_2 import doUpgrade as doCalendarUpgrade_1_to_2
@@ -203,6 +202,7 @@
     @Configure.responder
     def configure(self, filename, appropriateStoreClass, merge):
         subsvc = None
+        from txdav.common.datastore.file import CommonDataStore as FileStore
         self.upgrader = UpgradeToDatabaseStep(
             FileStore(
                 CachingFilePath(filename), None, None, True, True,
@@ -269,9 +269,8 @@
         @type path: L{CachingFilePath}
         """
 
-        # TODO: TOPPATHS should be computed based on enabled flags in 'store',
-        # not hard coded.
-        for homeType in TOPPATHS:
+        # Legacy: old file store only ever used these two top-level paths
+        for homeType in ("calendars", "addressbooks"):
             if path.child(homeType).exists():
                 if platform.isMacOSX():
                     appropriateStoreClass = XattrPropertyStore
@@ -303,6 +302,7 @@
 
                     appropriateStoreClass = AppleDoubleStore
 
+                from txdav.common.datastore.file import CommonDataStore as FileStore
                 return FileStore(
                     path, None, None, True, True,
                     propertyStoreClass=appropriateStoreClass)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160503/c76ff1a3/attachment.html>


More information about the calendarserver-changes mailing list