You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to using this library so it's possible I'm misunderstanding how these property types are being used. I was trying to add an rsvp parameter to an attendee as a vBoolean and got a stacktrace.
Automatic encoding is not yet implemented for parameter values, so you must use the ‘v*’ types you can import from the icalendar package (they’re defined in icalendar.prop):
Looking through the code, it seems like this issue exists for any of the property types that are not based on str, list, or tuple. list and tuple go through q_join() while everything else goes through dquote() which requires it to have a str.replace() method.
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "icalendar/cal.py", line 430, in to_ical
content_lines = self.content_lines(sorted=sorted)
File "icalendar/cal.py", line 419, in content_lines
cl = self.content_line(name, value, sorted=sorted)
File "icalendar/cal.py", line 412, in content_line
return Contentline.from_parts(name, params, value, sorted=sorted)
File "icalendar/parser.py", line 315, in from_parts
return cls(f'{name}:{values}')
File "icalendar/parser.py", line 218, in to_ical
value = param_value(value)
File "icalendar/parser.py", line 105, in param_value
return dquote(value)
File "icalendar/parser.py", line 144, in dquote
val = val.replace('"', "'")
AttributeError: 'vBoolean' object has no attribute 'replace'
Describe the bug
I'm new to using this library so it's possible I'm misunderstanding how these property types are being used. I was trying to add an
rsvp
parameter to an attendee as avBoolean
and got a stacktrace.The docs talk about doing it this way:
Looking through the code, it seems like this issue exists for any of the property types that are not based on
str
,list
, ortuple
.list
andtuple
go throughq_join()
while everything else goes throughdquote()
which requires it to have astr.replace()
method.icalendar/src/icalendar/parser.py
Lines 100 to 105 in 16f9015
To Reproduce
Output:
(file paths reduced to make it easier to read)
Expected behavior
Environment
icalendar
version: 5.0.3Additional context
pip3 install https://github.com/collective/icalendar.git
The text was updated successfully, but these errors were encountered: