Open danielschenk opened 8 months ago
I would think that is is nice to add a few default properties that make the calendar valid. If you like to create a Pull Request, that would be welcome!
I'll gladly do! I will dive into the code as soon as I have time for it.
@danielschenk I had another thought about it.
What we can do with icalendar is ICS -> Python object -> ICS That does not require any validity and we want to support reading ICS files that are not valid as well as modifying them and saving them.
So, what I would propose is a method make_valid()
on the calendar and components. That would i.e. write the mandatory fields like event UID or calendar scale and timezones used.
That method can be improved time and time again. What do you think about that?
See also:
According to RFC 5545, every VCAL needs a
PRODID
andVERSION
. If those are not explicitly added,Calendar.to_ical()
produces non-conforming output because they are missing.It could be a deliberate design choice to leave this open. But I wonder, how often do people want to generate invalid output, and shouldn't the library enforce a valid calendar object somehow?
Just some suggestions here.
VERSION
As this library claims to be implementing RFC 5545, I think this should just be
2.0
by default. If you add it again with a different value, that's fine, it will be replaced.PRODID
What about setting this to something like
-//python.collective.icalendar//NONSGML python.collective.icalendar.app.event//EN
? (I'm not sure how exactly these strings should be constructed, I just wrote something based on a test case I saw in this repo). Same here, if you add it again with a different value, it will be replaced.Both of above improvements are fully backwards-compatible, AFAIK. Please let me know your thoughts.