More efficient lineFolder implementation
authorJames French <[email protected]>
Mon, 2 Aug 2010 06:35:01 +0000 (14:35 +0800)
committerJames French <[email protected]>
Mon, 2 Aug 2010 06:35:57 +0000 (14:35 +0800)
icalparse.py

index 0fd0de7..cc548a3 100755 (executable)
@@ -60,12 +60,13 @@ def lineFolder(oldcal, length=75):
                if len(line.rstrip()) <= length:
                        cal.append(line)
                else:
-                       brokenline = [line[0:length] + '\r\n']
+                       brokenline = [line[0:length]]
                        ll = length
-                       while ll < len(line.rstrip('\r\n')) + 1:
-                               brokenline.append(' ' + line[ll:sl+ll].rstrip('\r\n') + '\r\n')
+                       while ll < len(line) + 1:
+                               brokenline.append(line[ll:sl+ll])
                                ll += sl
-                       cal += brokenline
+                       brokenline = '\r\n '.join(brokenline)
+                       cal.append(brokenline)
 
        return cal
 

UCC git Repository :: git.ucc.asn.au