Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Todo constructor and "from_string" function do not allow values that the official validator does allow #441

Open
2 tasks done
BMaxV opened this issue Oct 24, 2024 · 0 comments

Comments

@BMaxV
Copy link

BMaxV commented Oct 24, 2024

Hello everyone!

Thanks for making this software, I found a minor thing that's potentially a bit annoying because it prevents me from using custom values.

I can of course always work around it by putting it into the summary or something, as text, but that's obviously not ideal.

The official validator didn't mind me putting in seemingly arbitrary values. I'm not sure if that's intentional.

Describe the bug

The .calendar_from_ics and the Todo object constructor (?) don't accept my arbitrary classification "HERPADERPA" as a possible / valid value for classification. But the official validator, does.

https://icalendar.org/iCalendar-RFC-5545/3-8-1-3-classification.html

It doesn't look like you allow the IANA and X-types.

value is not a valid enumeration member; permitted: 'PUBLIC', 'PRIVATE', 'CONFIDENTIAL' (type=type_error.enum; enum_values=[<Classification.PUBLIC: 'PUBLIC'>, <Classification.PRIVATE: 'PRIVATE'>, <Classification.CONFIDENTIAL: 'CONFIDENTIAL'>])

I'm not actually sure how the "X-" values are supposed to be defined. But the official validator didn't complain.

To Reproduce

Go to the validtor, plug it in and observe the result.

https://icalendar.org/validator.html

BEGIN:VCALENDAR
PRODID:-//github.com/allenporter/ical//8.2.0//EN
VERSION:2.0
BEGIN:VTODO
UID:[email protected]
DTSTAMP:20250313T123432Z
DUE;VALUE=DATE:20070501
SUMMARY:Submit Quebec Income Tax Return for 2006
CLASS:CONFIDENTIAL,HERPADERPA
CATEGORIES:FAMILY,FINANCE
X-HER-PADERPA:foobar
STATUS:NEEDS-ACTION
END:VTODO
END:VCALENDAR

alternatively, run this code, observe that it fails.

from ical.calendar import Calendar
from ical.calendar_stream import IcsCalendarStream

s="""
BEGIN:VCALENDAR
PRODID:-//github.com/allenporter/ical//8.2.0//EN
VERSION:2.0
BEGIN:VTODO
UID:[email protected]
DTSTAMP:20250313T123432Z
DUE;VALUE=DATE:20070501
SUMMARY:Submit Quebec Income Tax Return for 2006
CLASS:CONFIDENTIAL,X-HERPA;VALUE=foo:bar
CATEGORIES:FAMILY,FINANCE
X-HER-PADERPA:foobar
STATUS:NEEDS-ACTION
END:VTODO
END:VCALENDAR
"""
calendar = IcsCalendarStream.calendar_from_ics(s)

Expected behavior

  • no crash
  • safe defaults like "private" as specified in the standard
  • maybe a warning?

Environment

  • OS: ubuntu 22.04
  • Python version: Python 3.10.12
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

No branches or pull requests

1 participant