Skip to content

fix: read CATEGORIES spread over several lines - #72

Merged
tobixen merged 1 commit into
masterfrom
fix/categories-multiple-lines
Oct 14, 2026
Merged

tobixen merged 1 commit into
masterfrom
fix/categories-multiple-lines

Conversation

@tobixen

@tobixen tobixen commented Oct 14, 2026

Copy link
Copy Markdown
Member

Commit message:

RFC 5545 allows CATEGORIES more than once, and icalendar then
returns a list; list-categories and timewarrior tracking crashed on
it.  Both now use comp.categories (icalendar>=6.2.0), skipping empty
values.  That accessor inserts an empty CATEGORIES when there is none
(https://github.com/collective/icalendar/issues/1722), so the
interactive category prompt may store a blank line until caldav also
cleans on save (https://github.com/python-caldav/caldav/issues/774).

Fixes https://github.com/pycalendar/plann/issues/71

Prompt: I think https://github.com/pycalendar/plann/issues/71 should just be fixed. (...)
Followup-Prompt: I think maybe we're going a bit over the board (sic) here.  1) the correct fix is to use `icalendar_component.categories` all over the place.  I'm reluctant to make workarounds everywhere for a bug that will be fixed at some point - and an empty CATEGORY-line is not that bad, as long as we can avoid crashing on it.  2) we have a workaround in place in caldav removing blank CATEGORIES-lines now when loading data from the server, and soon enough it will do the same on writes.  I think that's all that is needed.

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>

RFC 5545 allows CATEGORIES more than once, and icalendar then
returns a list; list-categories and timewarrior tracking crashed on
it.  Both now use comp.categories (icalendar>=6.2.0), skipping empty
values.  That accessor inserts an empty CATEGORIES when there is none
(PyCalendar/icalendar#1722), so the
interactive category prompt may store a blank line until caldav also
cleans on save (python-caldav/caldav#774).

Fixes #71

Prompt: I think #71 should just be fixed. (...)
Followup-Prompt: I think maybe we're going a bit over the board (sic) here.  1) the correct fix is to use `icalendar_component.categories` all over the place.  I'm reluctant to make workarounds everywhere for a bug that will be fixed at some point - and an empty CATEGORY-line is not that bad, as long as we can avoid crashing on it.  2) we have a workaround in place in caldav removing blank CATEGORIES-lines now when loading data from the server, and soon enough it will do the same on writes.  I think that's all that is needed.

Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewed-by: Tobias Brox <tobias@redpill-linpro.com>
@tobixen
tobixen merged commit 8416b8a into master Oct 14, 2026
9 checks passed
@tobixen
tobixen deleted the fix/categories-multiple-lines branch October 14, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant