python-caldav / caldav

Apache License 2.0
328 stars 97 forks source link

Possible arguments to `calendar.save_event()` and `calendar.search()` is poorly documented #253

Open tobixen opened 1 year ago

tobixen commented 1 year ago

... and there is calendar.save_todo and calendar.save_journal as well.

gravityfargo commented 1 year ago

Parameters for search are listed well. The same for save_event / save_todo would be nice.

ical_fragment

    ## ical_fragment parameter -> just some lines
    ## ical parameter -> full ical object

confuses me as well.

Edit: This?

Edit: print(obj.icalendar_component.keys()) told me what I needed to know $ odict_keys(['CREATED', 'DTSTAMP', 'LAST-MODIFIED', 'SUMMARY', 'UID'])

Another edit: The section "# Property types" at the bottom of icalendar.prop seems to have a comprehensive list.

rgerbranda commented 11 months ago

Did anyone manage to add an alarm using the props?

The following is listed, but doesn't seems to work.

    # Alarm Component Properties
    'action': 'text',
    'repeat': 'integer',
    'trigger': 'duration',
tobixen commented 11 months ago

Is that when doing calendar.save_event()? Alarms are badly supported (though it should be possible to add them i.e. through event.icalendar_component['VALARM'] = ...).

I was working a bit on alarms at one point, but ran out of time ... I think that work is still in a separate branch (with a draft pull request and an issue attached).

tobixen commented 11 months ago

221 that was. And https://github.com/python-caldav/caldav/issues/132#issuecomment-1287973589

rgerbranda commented 11 months ago

No problem, I can use Ical data to add VALARM

I had the following error when adding the event, but that was caused by extra linebreaks at the beginning and ending of the Ical data. Removed the linebreaks in the Ical data, now it is working fine.

Ical data was modified to avoid compatibility issues

tobixen commented 11 months ago

That's not an error, that's a warning. It's a bit of a bugger, a caldav library is expected to pass the icalendar data unmodified, still I want to be flexible and pragmatic and do whatever I can for things to just work - so that includes fixing broken icalendar data. At some point I decided to add a warning about it - it's been a bugging problem particularly for some HomeAssistant users that gets lots of those messages stuck in the log :-)