modoboa / modoboa-radicale

The Radicale frontend of Modoboa
MIT License
21 stars 14 forks source link

Error 500 when trying to switch to next month #23

Open Toniob opened 6 years ago

Toniob commented 6 years ago

Hi,

With extension 1.3.0, the events are working fine on the current month. But when I try to switch to the next month (May), I'm having an error :

Traceback:  

File "/dir/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/dir/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/dir/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/lib/python3.5/contextlib.py" in inner
  30.                 return func(*args, **kwds)

File "/dir/lib/python3.5/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/dir/lib/python3.5/site-packages/rest_framework/viewsets.py" in view
  90.             return self.dispatch(request, *args, **kwargs)

File "/dir/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
  489.             response = self.handle_exception(exc)

File "/dir/lib/python3.5/site-packages/rest_framework/views.py" in handle_exception
  449.             self.raise_uncaught_exception(exc)

File "/dir/lib/python3.5/site-packages/rest_framework/views.py" in dispatch
  486.             response = handler(request, *args, **kwargs)

File "/dir/lib/python3.5/site-packages/modoboa_radicale/viewsets.py" in list
  128.             parse_date_from_iso(start), parse_date_from_iso(end))

File "/dir/lib/python3.5/site-packages/modoboa_radicale/backends/caldav_.py" in get_events
  143.         orig_events = self.remote_cal.date_search(start, end)

File "/dir/src/caldav/caldav/objects.py" in date_search
  572.                       data=results[r][cdav.CalendarData.tag], parent=self))

File "/dir/src/caldav/caldav/objects.py" in __init__
  813.             self.data = data

File "/dir/src/caldav/caldav/objects.py" in _set_data
  898.                 to_unicode(self._data))

File "/dir/lib/python3.5/site-packages/icalendar/cal.py" in from_ical
  369.                     _timezone_cache[component['TZID']] = component.to_tz()

File "/dir/lib/python3.5/site-packages/icalendar/cal.py" in to_tz
  611.                 component, tzname

File "/dir/lib/python3.5/site-packages/icalendar/cal.py" in _extract_offsets
  540.             rrule = dateutil.rrule.rrulestr(rrulestr, dtstart=dtstart)

File "/dir/lib/python3.5/site-packages/dateutil/rrule.py" in __call__
  1664.         return self._parse_rfc(s, **kwargs)

File "/dir/lib/python3.5/site-packages/dateutil/rrule.py" in _parse_rfc
  1547.                                          tzinfos=tzinfos)

File "/dir/lib/python3.5/site-packages/dateutil/rrule.py" in _parse_rfc_rrule
  1506.         return rrule(dtstart=dtstart, cache=cache, **rrkwargs)

File "/dir/lib/python3.5/site-packages/dateutil/rrule.py" in __init__
  461.                     'RRULE UNTIL values must be specified in UTC when DTSTART '

Exception Type: ValueError at /api/v1/user-calendars/1/events/
Exception Value: RRULE UNTIL values must be specified in UTC when DTSTART is timezone-aware
Request information:
USER: ******@6clones.fr

GET:
start = '2018-04-30'
_ = '1522766925092'
end = '2018-06-11'
tonioo commented 6 years ago

The error is raised by the dateutil package when it parses your event. Looks like developers recently decided to be more RFC compliant (see https://github.com/dateutil/dateutil/issues/620) with inconsistency issues between DTSTART and UNTIL properties... Problem is, a lot a calendar clients generate wrong events (Outlook, Evolution, etc.) For now, there is not easy way to fix this...