[Calypso] Incorrect parsing of rrule?
Guido Günther
agx at sigxcpu.org
Sun Jan 24 13:25:23 PST 2016
Hi Petter,
On Sun, Jan 24, 2016 at 09:11:22PM +0100, Petter Reinholdtsen wrote:
> [Petter Reinholdtsen]
> > After looking at the code, I suspect the problem is related to the
> > content of some calendar entry, but am unsure exactly what. Anyone got
> > any idea what to look for? The code in question seem to operate og
> > rrule entries.
>
> I enabled debugging, and got some more information about the exception.
>
> First line 'REPORT /calendars/user/ HTTP/1.1
> '
> keep-alive
> reqlen 514
> Path /calendars/user/ results in collection: /calendars/user
> entity Calendar-/calendars/user/ (at /home/calypso/.config/calypso/calcards/calendars/user) user user
> REPORT /calendars/user/ <?xml version="1.0" encoding="utf-8"?>
> <calendar-query xmlns="urn:ietf:params:xml:ns:caldav">
> <prop xmlns="DAV:">
> <getetag xmlns="DAV:"/>
> <resourcetype xmlns="DAV:"/>
> </prop>
> <filter xmlns="urn:ietf:params:xml:ns:caldav">
> <comp-filter xmlns="urn:ietf:params:xml:ns:caldav" name="VCALENDAR">
> <comp-filter xmlns="urn:ietf:params:xml:ns:caldav" name="VEVENT">
> <time-range xmlns="urn:ietf:params:xml:ns:caldav" start="20151021T201004Z"/>
> </comp-filter>
> </comp-filter>
> </filter>
> </calendar-query>
> Path /calendars/user/ results in collection: /calendars/user
> Path /calendars/user/ results in name: None
> Failed REPORT for /calendars/user/
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/calypso/__init__.py", line 495, in do_REPORT
> self._answer = xmlutils.report(self.path, xml_request, self._collection)
> File "/usr/lib/python2.7/dist-packages/calypso/xmlutils.py", line 352, in report
> if not match_filter(item, filter_element):
> File "/usr/lib/python2.7/dist-packages/calypso/xmlutils.py", line 307, in match_filter
> if match_filter_element(item.object, fe):
> File "/usr/lib/python2.7/dist-packages/calypso/xmlutils.py", line 256, in match_filter_element
> if match_filter_element (vc, fc):
> File "/usr/lib/python2.7/dist-packages/calypso/xmlutils.py", line 251, in match_filter_element
> if match_filter_element(vobject, fc):
> File "/usr/lib/python2.7/dist-packages/calypso/xmlutils.py", line 284, in match_filter_element
> end_datetime = dateutil.parser.parse(end)
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 748, in parse
> return DEFAULTPARSER.parse(timestr, **kwargs)
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 310, in parse
> res, skipped_tokens = self._parse(timestr, **kwargs)
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 366, in _parse
> l = _timelex.split(timestr)
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 150, in split
> return list(cls(s))
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 147, in next
> return self.__next__() # Python 2.x support
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 141, in __next__
> token = self.get_token()
> File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 72, in get_token
> nextchar = self.instream.read(1)
> AttributeError: 'NoneType' object has no attribute 'read'
> 84.215.38.245 - - [24/Jan/2016 21:00:43] "REPORT /calendars/user/ HTTP/1.1" 400 -
> SSL request error: 'The read operation timed out'
> First line 'REPORT /calendars/user/ HTTP/1.1
> '
> keep-alive
> reqlen 513
> Path /calendars/user/ results in collection: /calendars/user
> entity Calendar-/calendars/user/ (at /home/calypso/.config/calypso/calcards/calendars/user) user user
> REPORT /calendars/user/ <?xml version="1.0" encoding="utf-8"?>
> <calendar-query xmlns="urn:ietf:params:xml:ns:caldav">
> <prop xmlns="DAV:">
> <getetag xmlns="DAV:"/>
> <resourcetype xmlns="DAV:"/>
> </prop>
> <filter xmlns="urn:ietf:params:xml:ns:caldav">
> <comp-filter xmlns="urn:ietf:params:xml:ns:caldav" name="VCALENDAR">
> <comp-filter xmlns="urn:ietf:params:xml:ns:caldav" name="VTODO">
> <time-range xmlns="urn:ietf:params:xml:ns:caldav" start="20151021T201004Z"/>
> </comp-filter>
> </comp-filter>
> </filter>
> </calendar-query>
> Path /calendars/user/ results in collection: /calendars/user
> Path /calendars/user/ results in name: None
> REPORT ANSWER <ns0:multistatus xmlns:ns0="DAV:" />
> 84.215.38.245 - - [24/Jan/2016 21:00:48] "REPORT /calendars/user/ HTTP/1.1" 207 -
If I do:
py> dateutil.parser.parse(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 1008, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 392, in parse
res = self._parse(timestr, **kwargs)
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 492, in _parse
l = _timelex.split(timestr) # Splits the timestr into tokens
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 174, in split
return list(cls(s))
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 171, in next
return self.__next__() # Python 2.x support
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 164, in __next__
token = self.get_token()
File "/usr/lib/python2.7/dist-packages/dateutil/parser.py", line 82, in get_token
nextchar = self.instream.read(1)
AttributeError: 'NoneType' object has no attribute 'read'
this looks pretty much like your exception.
> Is the problem perhaps that the <time-range> xml tag is missing an end
> tag? Is this required by the protocol?
https://tools.ietf.org/html/rfc4791#section-9.9
says that one element is sufficient. Assuming -∞ or +∞ respectively. Can
you cook up a patch to fix this and at tests that we don't regress
later?
Cheers,
-- Guido
More information about the Calypso
mailing list