[CalendarServer-changes] [5217] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 25 11:59:57 PST 2010


Revision: 5217
          http://trac.macosforge.org/projects/calendarserver/changeset/5217
Author:   wsanchez at apple.com
Date:     2010-02-25 11:59:57 -0800 (Thu, 25 Feb 2010)
Log Message:
-----------
Import twext.python.plistlib, not plistlib

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/anonymize.py
    CalendarServer/trunk/calendarserver/tools/fixcalendardata.py
    CalendarServer/trunk/calendarserver/tools/gateway.py
    CalendarServer/trunk/calendarserver/tools/test/test_gateway.py
    CalendarServer/trunk/contrib/migration/59_calendarmigrator.py
    CalendarServer/trunk/twistedcaldav/report_addressbook_findshared.py

Modified: CalendarServer/trunk/calendarserver/tools/anonymize.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/anonymize.py	2010-02-25 06:49:38 UTC (rev 5216)
+++ CalendarServer/trunk/calendarserver/tools/anonymize.py	2010-02-25 19:59:57 UTC (rev 5217)
@@ -23,7 +23,6 @@
 import datetime
 import hashlib
 import os
-import plistlib
 import random
 import shutil
 import sys
@@ -33,6 +32,8 @@
 import xattr
 import zlib
 
+from twext.python.plistlib import readPlistFromString
+
 COPY_CAL_XATTRS = (
     'WebDAV:{DAV:}resourcetype',
     'WebDAV:{urn:ietf:params:xml:ns:caldav}calendar-timezone',
@@ -375,7 +376,7 @@
             if child.returncode:
                 raise DirectoryError(error)
             else:
-                records = plistlib.readPlistFromString(output)
+                records = readPlistFromString(output)
                 random.shuffle(records) # so we don't go alphabetically
 
                 for record in records:

Modified: CalendarServer/trunk/calendarserver/tools/fixcalendardata.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/fixcalendardata.py	2010-02-25 06:49:38 UTC (rev 5216)
+++ CalendarServer/trunk/calendarserver/tools/fixcalendardata.py	2010-02-25 19:59:57 UTC (rev 5217)
@@ -16,7 +16,6 @@
 # limitations under the License.
 ##
 
-from plistlib import readPlist
 import re
 import datetime
 import getopt
@@ -26,6 +25,8 @@
 import time
 import xattr
 
+from twext.python.plistlib import readPlist
+
 PLIST_FILE = "/etc/caldavd/caldavd.plist"
 SCAN_FILE = "problems.txt"
 

Modified: CalendarServer/trunk/calendarserver/tools/gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/gateway.py	2010-02-25 06:49:38 UTC (rev 5216)
+++ CalendarServer/trunk/calendarserver/tools/gateway.py	2010-02-25 19:59:57 UTC (rev 5217)
@@ -20,10 +20,11 @@
 from grp import getgrnam
 from pwd import getpwnam
 import os
-import plistlib
 import sys
 import xml
 
+from twext.python.plistlib import readPlistFromString, writePlistToString
+
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
 from twisted.python.util import switchUID
@@ -115,7 +116,7 @@
     #
     rawInput = sys.stdin.read()
     try:
-        plist = plistlib.readPlistFromString(rawInput)
+        plist = readPlistFromString(rawInput)
     except xml.parsers.expat.ExpatError, e:
         respondWithError(str(e))
         return
@@ -438,10 +439,10 @@
     respond(command, result)
 
 def respond(command, result):
-    sys.stdout.write(plistlib.writePlistToString( { 'command' : command['command'], 'result' : result } ) )
+    sys.stdout.write(writePlistToString( { 'command' : command['command'], 'result' : result } ) )
 
 def respondWithError(msg, status=1):
-    sys.stdout.write(plistlib.writePlistToString( { 'error' : msg, } ) )
+    sys.stdout.write(writePlistToString( { 'error' : msg, } ) )
     """
     try:
         reactor.stop()

Modified: CalendarServer/trunk/calendarserver/tools/test/test_gateway.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/test/test_gateway.py	2010-02-25 06:49:38 UTC (rev 5216)
+++ CalendarServer/trunk/calendarserver/tools/test/test_gateway.py	2010-02-25 19:59:57 UTC (rev 5217)
@@ -15,7 +15,7 @@
 ##
 
 import os
-import plistlib
+from twext.python.plistlib import readPlistFromString
 import xml
 
 from twext.python.filepath import CachingFilePath as FilePath
@@ -90,7 +90,7 @@
         reactor.spawnProcess(CapturingProcessProtocol(deferred, command), python, args, env=os.environ, path=cwd)
         output = yield deferred
         try:
-            plist = plistlib.readPlistFromString(output)
+            plist = readPlistFromString(output)
         except xml.parsers.expat.ExpatError, e:
             print "Error (%s) parsing (%s)" % (e, output)
             raise

Modified: CalendarServer/trunk/contrib/migration/59_calendarmigrator.py
===================================================================
--- CalendarServer/trunk/contrib/migration/59_calendarmigrator.py	2010-02-25 06:49:38 UTC (rev 5216)
+++ CalendarServer/trunk/contrib/migration/59_calendarmigrator.py	2010-02-25 19:59:57 UTC (rev 5217)
@@ -23,11 +23,11 @@
 import datetime
 import optparse
 import os
-import plistlib
 import shutil
-import subprocess
 import sys
 
+from twext.python.plistlib import readPlist, writePlist
+
 LAUNCHD_KEY = "org.calendarserver.calendarserver"
 LOG = "/Library/Logs/Migration/calendarmigrator.log"
 SERVICE_NAME = "calendar"
@@ -134,10 +134,10 @@
                 if name == "caldavd.plist":
                     # Migrate certain settings from the old plist to new:
                     log("Parsing %s" % (oldPath,))
-                    oldPlist = plistlib.readPlist(oldPath)
+                    oldPlist = readPlist(oldPath)
                     if os.path.exists(newPath):
                         log("Parsing %s" % (newPath,))
-                        newPlist = plistlib.readPlist(newPath)
+                        newPlist = readPlist(newPath)
                         log("Removing %s" % (newPath,))
                         os.remove(newPath)
                     else:
@@ -145,7 +145,7 @@
                     log("Processing %s" % (oldPath,))
                     mergePlist(oldPlist, newPlist)
                     log("Writing %s" % (newPath,))
-                    plistlib.writePlist(newPlist, newPath)
+                    writePlist(newPlist, newPath)
 
                 else:
                     # Copy the file over, overwriting copy in newConfigDir
@@ -208,7 +208,7 @@
 
     overridesPath = os.path.join(source, LAUNCHD_OVERRIDES)
     if os.path.isfile(overridesPath):
-        overrides = plistlib.readPlist(overridesPath)
+        overrides = readPlist(overridesPath)
         try:
             return overrides[service]['Disabled']
         except KeyError:
@@ -217,7 +217,7 @@
 
     prefsPath = os.path.join(source, LAUNCHD_PREFS_DIR, "%s.plist" % service)
     if os.path.isfile(prefsPath):
-        prefs = plistlib.readPlist(prefsPath)
+        prefs = readPlist(prefsPath)
         try:
             return prefs['Disabled']
         except KeyError:
@@ -238,11 +238,11 @@
 
     overridesPath = os.path.join(target, LAUNCHD_OVERRIDES)
     if os.path.isfile(overridesPath):
-        overrides = plistlib.readPlist(overridesPath)
+        overrides = readPlist(overridesPath)
         if not overrides.has_key(service):
             overrides[service] = { }
         overrides[service]['Disabled'] = disabled
-        plistlib.writePlist(overrides, overridesPath)
+        writePlist(overrides, overridesPath)
 
 
 class ServiceStateError(Exception):

Modified: CalendarServer/trunk/twistedcaldav/report_addressbook_findshared.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/report_addressbook_findshared.py	2010-02-25 06:49:38 UTC (rev 5216)
+++ CalendarServer/trunk/twistedcaldav/report_addressbook_findshared.py	2010-02-25 19:59:57 UTC (rev 5217)
@@ -26,7 +26,7 @@
     "getWritersGroupForSharedAddressBookGroup",
 ]
 
-from plistlib import readPlist
+from twext.python.plistlib import readPlist
 #import traceback
 
 import opendirectory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100225/c0c0f64c/attachment.html>


More information about the calendarserver-changes mailing list