Replies: 3 comments 8 replies
-
|
This would help icalendar-anonymizer. We rely on We'd use both: Scrubbing: Would let us handle broken input gracefully instead of crashing on invalid calendars. Validation: Right now we can't tell users why their calendar is broken. We just pass through whatever exception API: I like errors = icalendar.validate_string(ics_string)
errors = calendar.validate()Return list of violations instead of exceptions. Our workflow would be:
Happy to test once there's a draft. |
Beta Was this translation helpful? Give feedback.
-
|
This is a package with a slightly different scope, I want to throw in the mix before I get into discussion at some point: |
Beta Was this translation helpful? Give feedback.
-
Can you add a definition in the proposal of what a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the caldav library, I have a function fixing broken icalendar data. The idea is that the library users should be able to fetch data from one calendar and play with it without other components breaking (particularly the vobject library that was used earlier had a tendency to raise errors on broken icalendar data). Six different observed issues are fixed, at least three of them have been observed recenly.
This function is not specific to the CalDAV library. @SashankBhamidi indicated that it would be useful in the anonymizer project and suggested to implement it in the icalendar library.
The current function takes a string and returns a string. In the icalendar library it would probably be better with a method accepting a string and returning an object. Maybe simply throwing in a
scrub=Falseparameter to the currentfrom_ical-method. One could also throw in possibilities to configure what should be scrubbed, how, scrubber-plugins, etc, but personally I think I favor the "keep it simple stupid" approach.The current test code uses the vobject library to validae the icalendar code. The vobject will raise errors on all the broken data found except the missing DTSTAMP. However, it would make more sense to create a validator method in the icalendar library. I think it's important to be able to validate both strings (which may be so broken that the
from_ical-method will raise errors) and icalendar objects (which may be missing mandatory fields, etc).So basically everything I have seems to need a complete rewrite before it can be moved to the icalendar library. Oh well, the current implementation is probably not catching all kthe corner cases anyway.
The logic is available here:
https://github.com/python-caldav/caldav/blob/master/caldav/lib/vcal.py
Test code here:
https://github.com/python-caldav/caldav/blob/master/tests/test_vcal.py
Beta Was this translation helpful? Give feedback.
All reactions