[CalendarServer-changes] [13773] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 17 12:04:53 PDT 2014


Revision: 13773
          http://trac.calendarserver.org//changeset/13773
Author:   cdaboo at apple.com
Date:     2014-07-17 12:04:53 -0700 (Thu, 17 Jul 2014)
Log Message:
-----------
Fix resource/location migration from OD.

Modified Paths:
--------------
    CalendarServer/trunk/requirements-stable.txt
    CalendarServer/trunk/twistedcaldav/upgrade.py
    CalendarServer/trunk/txdav/who/opendirectory.py

Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt	2014-07-17 19:03:29 UTC (rev 13772)
+++ CalendarServer/trunk/requirements-stable.txt	2014-07-17 19:04:53 UTC (rev 13773)
@@ -5,7 +5,7 @@
 # For CalendarServer development, don't try to get these projects from PyPI; use svn.
 
 -e .
--e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13750#egg=twextpy
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@13771#egg=twextpy
 -e svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk@13420#egg=kerberos
 -e svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk@13711#egg=pycalendar
 

Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py	2014-07-17 19:03:29 UTC (rev 13772)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py	2014-07-17 19:04:53 UTC (rev 13773)
@@ -919,14 +919,25 @@
 
     # Create internal copies of resources and locations based on what is
     # found in OD
+    from twext.who.idirectory import RecordType as BaseRecordType
     from twext.who.opendirectory import (
         DirectoryService as OpenDirectoryService
     )
+    from twext.who.util import ConstantsContainer
     from calendarserver.tools.resources import migrateResources
-    return migrateResources(OpenDirectoryService(), directory)
+    from txdav.who.opendirectory import _CSRecordType # Use this module for the import to make sure constants are setup properly
 
+    # We need to "patch" twext.who.opendirectory._service.DirectoryService to include resources and locations as supported record types
+    # during migration
+    class EnhancedDirectoryService(OpenDirectoryService):
+        recordType = ConstantsContainer((
+            BaseRecordType.user, BaseRecordType.group, _CSRecordType.location, _CSRecordType.resource
+        ))
 
+    return migrateResources(EnhancedDirectoryService(), directory)
 
+
+
 @inlineCallbacks
 def migrateAutoSchedule(config, directory):
     # Fetch the autoSchedule assignments from resourceinfo.sqlite and store

Modified: CalendarServer/trunk/txdav/who/opendirectory.py
===================================================================
--- CalendarServer/trunk/txdav/who/opendirectory.py	2014-07-17 19:03:29 UTC (rev 13772)
+++ CalendarServer/trunk/txdav/who/opendirectory.py	2014-07-17 19:04:53 UTC (rev 13773)
@@ -19,7 +19,7 @@
 from __future__ import absolute_import
 
 """
-Calendar and contacts directory extentions to L{twext.who.opendirectory}.
+Calendar and contacts directory extensions to L{twext.who.opendirectory}.
 """
 
 __all__ = [
@@ -34,5 +34,5 @@
 from twext.who.opendirectory._constants import ODRecordType as _ODRecordType
 from .idirectory import RecordType as _CSRecordType
 
-_ODRecordType.location.recordType = _CSRecordType.location
+_ODRecordType.place.recordType = _CSRecordType.location     # Use dsRecTypeStandard:Places for calendar locations
 _ODRecordType.resource.recordType = _CSRecordType.resource
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140717/a821e0eb/attachment.html>


More information about the calendarserver-changes mailing list