Hi Cyrus, On Mon, Jan 11, 2010 at 03:58:49PM -0500, Cyrus Daboo wrote:
Hi,
--On January 11, 2010 9:42:45 AM -0500 Cyrus Daboo <cdaboo@apple.com> wrote:
calendarserver currently has two patches for vobject:
http://trac.calendarserver.org/browser/CalendarServer/trunk/lib-patches/v object/vobject.base.patch http://trac.calendarserver.org/browser/CalendarServer/trunk/lib-patches/v object/vobject.icalendar.patch that aren't upstream. Jeffrey said they both can be merged upstream. Any chance one of you guys could commit them so that stock vobject can be used to run calendarserver?
I will do this later today.
OK, most of the changes are now in. There were some changes related Thanks a lot.
to stricter parsing of calendar data that may not be applicable for more general use of vobject, so I have left those as patches on our side. What we need to do is come up with a way to programmatically set the stricter mode in vobject, then we can explicitly turn that on when running calendarserver and get rid of the remaining patch. So the only missing hunk is:
@@ -1663,9 +1675,10 @@ def stringToTextValues(s, listSeparator=',', charList=None, strict=False): else: current.append(char) else: - state = "read normal" + #state = "read normal" # leave unrecognized escaped characters for later passes - current.append('\\' + char) + #current.append('\\' + char) + raise ParseError("error: illegal escape sequence: '\\%s'" % (char,)) What about toggling a global like: diff --git a/vobject/icalendar.py b/vobject/icalendar.py index 4a1da7c..b1dcd94 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -29,6 +29,7 @@ twoHours = datetime.timedelta(hours=2) #---------------------------- TZID registry ------------------------------------ __tzidMap={} +leave_chars = True def toUnicode(s): """Take a string or unicode, turn it into unicode, decoding as utf-8""" @@ -1663,9 +1664,12 @@ def stringToTextValues(s, listSeparator=',', charList=None, strict=False): else: current.append(char) else: - state = "read normal" - # leave unrecognized escaped characters for later passes - current.append('\\' + char) + if leave_char: + state = "read normal" + # leave unrecognized escaped characters for later passes + current.append('\\' + char) + else: + raise ParseError("error: illegal escape sequence: '\\%s'" % (char,)) elif state == "end": #an end state if len(current) or len(results) == 0: it's not nice but should do the trick if calendarserver sets vobject.icalenddar.leave_chars = False Cheers, -- Guido