[BUG] RDATE can become None if value is invalid
niccokunzmann opened this issue · comments
Nicco Kunzmann commented
Describe the bug
The RDATE is None if it has an invalid PERIOD value in a list and that has an effect on the to_ical fundtion: None is in the ical, making it invalid RFC.
To Reproduce
>>>> import icalendar
>>>> s = b"""BEGIN:VEVENT
.... SUMMARY:RDATE period
.... DTSTART:19961230T020000Z
.... DTEND:19961230T060000Z
.... UID:rdate_period
.... RDATE;VALUE=PERIOD:19970101T180000Z/19970102T070000Z,199709T180000Z/PT5H30M
.... END:VEVENT"""
>>>> event = icalendar.Event.from_ical(s)
>>>> print(event.to_ical().decode())
BEGIN:VEVENT
SUMMARY:RDATE period
DTSTART:19961230T020000Z
DTEND:19961230T060000Z
UID:rdate_period
RDATE:None <------- error!
END:VEVENT
Expected behavior**
I would expect
- That the error is recorded in the event
- that this is not None as a value
Environment
- OS: Ubuntu
- Python version: 3.9
-
icalendar
version: 5.0.0
Additional context
- I tested it with the latest version
pip3 install https://github.com/collective/icalendar.git
- I attached the ICS source file or there is no ICS source file