[CalendarServer-changes] [13076] CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools /resources.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 31 18:19:58 PDT 2014


Revision: 13076
          http://trac.calendarserver.org//changeset/13076
Author:   wsanchez at apple.com
Date:     2014-03-31 18:19:58 -0700 (Mon, 31 Mar 2014)
Log Message:
-----------
lint

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/resources.py

Modified: CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/resources.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/resources.py	2014-04-01 01:12:02 UTC (rev 13075)
+++ CalendarServer/branches/users/sagen/move2who-4/calendarserver/tools/resources.py	2014-04-01 01:19:58 UTC (rev 13076)
@@ -15,38 +15,36 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ##
+
 from __future__ import print_function
 
+__all__ = [
+    "migrateResources",
+]
+
+from getopt import getopt, GetoptError
+from grp import getgrnam
 import os
+from pwd import getpwnam
 import sys
-from grp import getgrnam
-from pwd import getpwnam
-from getopt import getopt, GetoptError
 
+from calendarserver.tools.util import (
+    loadConfig, setupMemcached, checkDirectory
+)
+from twext.python.log import Logger, StandardIOObserver
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
 from twisted.python.util import switchUID
-
-from twext.python.log import Logger, StandardIOObserver
-
 from twistedcaldav.config import config, ConfigurationError
 from twistedcaldav.directory.appleopendirectory import OpenDirectoryService
 from twistedcaldav.directory.directory import DirectoryService, DirectoryError
 from twistedcaldav.directory.xmlfile import XMLDirectoryService
-
-from calendarserver.tools.util import loadConfig, setupMemcached, checkDirectory
 from txdav.who.util import directoryFromConfig
 
 log = Logger()
 
 
 
-__all__ = [
-    "migrateResources",
-]
-
-
-
 def usage():
 
     name = os.path.basename(sys.argv[0])
@@ -156,14 +154,22 @@
     # Find the opendirectory service
     userService = config.directory.serviceForRecordType("users")
     resourceService = config.directory.serviceForRecordType("resources")
-    if (not isinstance(userService, OpenDirectoryService) or
-        not isinstance(resourceService, XMLDirectoryService)):
-        abort("This script only migrates resources and locations from OpenDirectory to XML; this calendar server does not have such a configuration.")
+    if (
+        not isinstance(userService, OpenDirectoryService) or
+        not isinstance(resourceService, XMLDirectoryService)
+    ):
+        abort(
+            "This script only migrates resources and locations from "
+            "OpenDirectory to XML; this calendar server does not have such a "
+            "configuration."
+        )
 
     #
     # Start the reactor
     #
-    reactor.callLater(0, migrate, userService, resourceService, verbose=verbose)
+    reactor.callLater(
+        0, migrate, userService, resourceService, verbose=verbose
+    )
     reactor.run()
 
 
@@ -208,8 +214,10 @@
 
 
 @inlineCallbacks
-def migrateResources(sourceService, destService, autoSchedules=None,
-    queryMethod=queryForType, verbose=False):
+def migrateResources(
+    sourceService, destService, autoSchedules=None,
+    queryMethod=queryForType, verbose=False
+):
 
     directoryRecords = []
     augmentRecords = []
@@ -234,23 +242,26 @@
                         autoSchedule = autoSchedules.get(guid, 1)
                     else:
                         autoSchedule = True
-                    augmentRecord = (yield destService.augmentService.getAugmentRecord(guid, recordType))
+                    augmentRecord = (
+                        yield destService.augmentService.getAugmentRecord(
+                            guid, recordType
+                        )
+                    )
                     augmentRecord.autoSchedule = autoSchedule
                     augmentRecords.append(augmentRecord)
 
-                    directoryRecords.append(
-                        (recordType,
-                            {
-                                "guid" : guid,
-                                "shortNames" : [recordName],
-                                "fullName" : fullName,
-                            }
-                        )
-                    )
+                    directoryRecords.append((
+                        recordType,
+                        {
+                            "guid": guid,
+                            "shortNames": [recordName],
+                            "fullName": fullName,
+                        }
+                    ))
 
     destService.createRecords(directoryRecords)
 
-    (yield destService.augmentService.addAugmentRecords(augmentRecords))
+    yield destService.augmentService.addAugmentRecords(augmentRecords)
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140331/b92059dd/attachment-0001.html>


More information about the calendarserver-changes mailing list