[Calendarserver-maintainers] Bug#569273: Bug#569273: Parsing \t (escaped tab character) raises ParseError
Guido Günther
agx at sigxcpu.org
Thu Feb 11 07:55:57 UTC 2010
On Thu, Feb 11, 2010 at 05:00:42AM +0100, Raphael Wimmer wrote:
> Package: python-vobject
> Version: 0.8.1c-3
>
> When parsing an iCal file containing "\t" (tab, actually two
> characters) using readOne(), the parser raises a ParseError,
> aborting the parsing.
> This defect is _not_ in the upstream source but introduced by Debian
> patch "0003-Treat-untils-as-floating.patch", removing this patch
> fixes the problem.
> I can not see any advantage of raising an exception instead of
> simply accepting unknown escaped chars (like in the upstream
> source).
This is the API calendarserver expects. However I'll apply this patch to
the next upload which should fix your issue:
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_chars:
+ 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:
We'll can the switch APIs in calendarserver until upstream fixed this.
Cheers,
-- Guido
>
> BTW: is there a reason why 0.8.1.c-3 is not present in the Debian git repo?
>
> Cheers,
> Raphael
>
>
> Test case:
>
> BEGIN:VCALENDAR
> VERSION:2.0
> BEGIN:VEVENT
> DTSTAMP:20080502T160934Z
> CREATED:20071005T104029Z
> UID:KOrganizer-1534264698.483
> SEQUENCE:1
> LAST-MODIFIED:20080106T231431Z
> DESCRIPTION:Test Text and a Tab: \t and more text
> SUMMARY:Test
> PRIORITY:3
> DTSTART:20071010T090000Z
> DTEND:20071010T120000Z
> TRANSP:OPAQUE
> END:VEVENT
> END:VCALENDAR
>
>
>
>
>
> _______________________________________________
> Calendarserver-maintainers mailing list
> Calendarserver-maintainers at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/calendarserver-maintainers
>
More information about the Calendarserver-maintainers
mailing list