From 8deb30a4ba5d4368c59b153df06aeeff60a26dbf Mon Sep 17 00:00:00 2001 From: James French Date: Mon, 2 Aug 2010 14:35:01 +0800 Subject: [PATCH] More efficient lineFolder implementation --- icalparse.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/icalparse.py b/icalparse.py index 0fd0de7..cc548a3 100755 --- a/icalparse.py +++ b/icalparse.py @@ -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 -- 2.20.1