[CalendarServer-changes] [3581] CalendarServer/trunk/calendarserver/tools/fixcalendardata.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 9 11:26:31 PST 2009


Revision: 3581
          http://trac.macosforge.org/projects/calendarserver/changeset/3581
Author:   cdaboo at apple.com
Date:     2009-01-09 11:26:30 -0800 (Fri, 09 Jan 2009)
Log Message:
-----------
Handle the case where an entire line has \'s on it.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/fixcalendardata.py

Modified: CalendarServer/trunk/calendarserver/tools/fixcalendardata.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/fixcalendardata.py	2009-01-09 17:09:46 UTC (rev 3580)
+++ CalendarServer/trunk/calendarserver/tools/fixcalendardata.py	2009-01-09 19:26:30 UTC (rev 3581)
@@ -89,7 +89,9 @@
                 level2Path = os.path.join(level1Path, "%02X" % (j,))
                 if os.path.exists(level2Path):
                     for item in os.listdir(level2Path):
-                        scanCalendarHome(basePath, os.path.join(level2Path, item), scanFile, doFix)
+                        calendarHome = os.path.join(level2Path, item)
+                        if os.path.isdir(calendarHome):
+                            scanCalendarHome(basePath, calendarHome, scanFile, doFix)
 
 def scanCalendarHome(basePath, calendarHome, scanFile, doFix):
     print "Scanning: %s" % (calendarHome,)
@@ -134,7 +136,7 @@
 
         # See whether there is a \" that needs fixing.
         # NB Have to handle the case of a folded line... 
-        if icsData.find('\\"') != -1 or icsData.find('\\\r\n "') != -1:
+        if icsData.find('\\"') != -1 or icsData.find('\\\r\n "') != -1 or icsData.find('\r\n \r\n "') != -1:
             if doFix:
                 if fixPath(icsPath, icsData):
                     didFix = True
@@ -208,7 +210,7 @@
         
     # Fix by continuously replacing \" with " until no more replacements occur
     while True:
-        newIcsData = icsData.replace('\\"', '"').replace('\\\r\n "', '\r\n "')
+        newIcsData = icsData.replace('\\"', '"').replace('\\\r\n "', '\r\n "').replace('\r\n \r\n "', '\r\n "')
         if newIcsData == icsData:
             break
         else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090109/81542a38/attachment.html>


More information about the calendarserver-changes mailing list