todoman
todoman copied to clipboard
Expected datetime, date, or time, got: '%s'" % ical
On the master branch, commit https://github.com/pimutils/todoman/commit/f2a006b2b057a33c6d06cafb7e4ab9ba7c61d8c2, todo list gives
Failed to read entry /home/konfekt/.local/share/vdirsyncer/todo/Todo4182454.ics.
Traceback (most recent call last):
File "/home/konfekt/.local/lib/python3.6/site-packages/todoman/model.py", line 954, in update_cache
cal = icalendar.Calendar.from_ical(cal)
File "/home/konfekt/.local/lib/python3.6/site-packages/icalendar/cal.py", line 383, in from_ical
vals = factory(factory.from_ical(vals))
File "/home/konfekt/.local/lib/python3.6/site-packages/icalendar/prop.py", line 348, in from_ical
"Expected datetime, date, or time, got: '%s'" % ical
ValueError: Expected datetime, date, or time, got: ''
as soon as the ics file contains the three empty entries
DTSTART:
STATUS:
COMPLETED:
Unfortunately, the Android applications aCalendar Tasks and OpenTasks both generate these empty fields by default.
Deleting these three empty entries manually resolves the error. Could todoman ignore these empty entries instead of throwing the error?
Looks like empty values for these fields are not valid (as per RFC5545).
If I have the time, I might work around accepting these invalid values, however, you should report this to these Android tasks, since they're generating what seems to be, invalid iCalendar files.
Okay, reported to CalDav-Sync. Still, does not hurt to accept these from a user's perspective who does not have strong opinions on whether an empty date counts as a date.
This issue has just been brought to my attention and I've tried to reproduce this immediately. So far I have not been successful. @Konfekt can you give me the exact steps to create such a broken ics file with OpenTasks and CalDAV-Sync? When I create a simple task with a due date in OpenTasks this gets uploaded to my server:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//dmfs.org//mimedir.icalendar//EN
BEGIN:VTODO
DUE:20181121T230000Z
CREATED:20181121T224931Z
LAST-MODIFIED:20181121T224931Z
SUMMARY:test123
STATUS:NEEDS-ACTION
DTSTAMP:20181121T224932Z
UID:21fb24f7-1bf4-4748-b257-7f437ab326fe.1542840572545
END:VTODO
END:VCALENDAR
That looks correct to me. What kind of CalDAV server are you using? Are there any other tools involved? Can you post a full ics that was uploaded to your server by CalDAV-Sync?
I'd advise against accepting broken input. Being fault tolerant only leads to faulty software. It's good to reject broken data and reach out to the creator of it.
It is the sync.memotoo.com server. No tools other than Open Tasks and CalDAV-Sync. I added a Task with name Task due the day after tomorrow. Then synced on Android and on Linux by vdirsyncer sync. The file memotooTodo4184174.ics that appears on Linux reads
BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VTODO
UID:memotooTodo4184174
SUMMARY:Test
DESCRIPTION:
DTSTART:
DUE:20181124T010000Z
PRIORITY:5
STATUS:
COMPLETED:
PERCENT-COMPLETE:0
CLASS:PRIVATE
DTSTAMP:20181122T002103Z
LAST-MODIFIED:20181122T002103Z
END:VTODO
END:VCALENDAR
Seemingly, this can be remedied by running an akonadi daemon by making Korganizer watch the vdirsyncer directory, and changes the entries to an acceptable format.
Looks like a Memotoo issue. Aside from the empty fields, there is another issue with this. A CalDAV server is not supposed to change file name nor UID of the object, but Memotoo clearly changed the UID. Also the PRODID field has been removed.
This may well be the reason for why the other direction doesn't work either. I imported your ics file onto my server and it was synced without any problem. I'll try to reactivate my Memotoo account and test it.
Thank you, yes, it would be good to know which servers do not invalidate the uploaded ICS files.
Most other servers don't. Check out fruux.com for instance.