Kozea / Radicale

A simple CalDAV (calendar) and CardDAV (contact) server.
https://radicale.org
GNU General Public License v3.0
3.28k stars 429 forks source link

Unable to use recurring TODOs: invalid recurrence rules in VTODO #764

Closed buster closed 6 years ago

buster commented 6 years ago

Trying to upload a weekly TODO i only get the error "invalid recurrence rules" but i have no idea why.. It looks valid to me..

BEGIN:VCALENDAR VERSION:2.0 PRODID:+//IDN bitfire.at//DAVdroid/1.9.9-gplay ical4j/2.x BEGIN:VTODO DTSTAMP:20180102T122043Z UID:5c36d0d5-15e7-4aad-8048-d8140a274a64 CREATED:20180102T122042Z LAST-MODIFIED:20180102T122042Z SUMMARY:Photochallenge STATUS:NEEDS-ACTION RRULE:FREQ=WEEKLY DUE;VALUE=DATE:20180101 END:VTODO END:VCALENDAR

buster commented 6 years ago

I figured that it looks like a problem with a newer vobject module. Using python3-vobject 0.9.3 i see the following:

Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vobject
>>> s = """BEGIN:VCALENDAR
... VERSION:2.0
... PRODID:+//IDN bitfire.at//DAVdroid/1.9.9-gplay ical4j/2.x
... BEGIN:VTODO
... DTSTAMP:20180102T122043Z
... UID:5c36d0d5-15e7-4aad-8048-d8140a274a64
... CREATED:20180102T122042Z
... LAST-MODIFIED:20180102T122042Z
... SUMMARY:Photochallenge
... STATUS:NEEDS-ACTION
... RRULE:FREQ=WEEKLY
... DUE;VALUE=DATE:20180101
... END:VTODO
... END:VCALENDAR"""
>>> v = vobject.readOne(s)
>>> c = [x for x in v.components()]
>>> c[0].rruleset
<dateutil.rrule.rruleset object at 0x7f1e9911d630>

But with version 0.9.5-1 i get an exception (which i believe leads to this error in the radicale code):

Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vobject
>>> s = """BEGIN:VCALENDAR
... VERSION:2.0
... PRODID:+//IDN bitfire.at//DAVdroid/1.9.9-gplay ical4j/2.x
... BEGIN:VTODO
... DTSTAMP:20180102T122043Z
... UID:5c36d0d5-15e7-4aad-8048-d8140a274a64
... CREATED:20180102T122042Z
... LAST-MODIFIED:20180102T122042Z
... SUMMARY:Photochallenge
... STATUS:NEEDS-ACTION
... RRULE:FREQ=WEEKLY
... DUE;VALUE=DATE:20180101
... END:VTODO
... END:VCALENDAR"""
>>> v = vobject.readOne(s)
>>> c = [x for x in v.components()]
>>> c
[<VTODO| [<CREATED{}2018-01-02 12:20:42+00:00>, <DTSTAMP{}2018-01-02 12:20:43+00:00>, <DUE{'VALUE': ['DATE']}2018-01-01>, <LAST-MODIFIED{}2018-01-02 12:20:42+00:00>, <RRULE{}FREQ=WEEKLY>, <STATUS{}NEEDS-ACTION>, <SUMMARY{}Photochallenge>, <UID{}5c36d0d5-15e7-4aad-8048-d8140a274a64>]>]
>>> c[0]
<VTODO| [<CREATED{}2018-01-02 12:20:42+00:00>, <DTSTAMP{}2018-01-02 12:20:43+00:00>, <DUE{'VALUE': ['DATE']}2018-01-01>, <LAST-MODIFIED{}2018-01-02 12:20:42+00:00>, <RRULE{}FREQ=WEEKLY>, <STATUS{}NEEDS-ACTION>, <SUMMARY{}Photochallenge>, <UID{}5c36d0d5-15e7-4aad-8048-d8140a274a64>]>
>>> c[0].rruleset
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/vobject/base.py", line 529, in __getattr__
    return self.contents[toVName(name)][0]
KeyError: 'rruleset'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/vobject/base.py", line 531, in __getattr__
    raise AttributeError(name)
AttributeError: rruleset

I've been using the Debian packages from stable and testing (stable works, testing doesn't) for this quick test. I'll open a bug report in vobject.

jcriner-dev commented 6 years ago

Buster,

I think this is a vobject issue, not a radicale one. I had all kinds of rrule issues upgrading to:

Radicale==2.1.8
vobject==0.9.5
python-dateutil==2.7.2

see my comments on your vobject issue https://github.com/eventable/vobject/issues/104 for a potential hotfix.