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

RSVP parameter leads to error. #411

Open
Noord opened this issue Jan 8, 2024 · 0 comments
Open

RSVP parameter leads to error. #411

Noord opened this issue Jan 8, 2024 · 0 comments

Comments

@Noord
Copy link

Noord commented Jan 8, 2024

Valid calendar definition with rsvp param.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//SmartCal//prodid//EN
METHOD:REQUEST
DTEND:20240112T130000Z
DTSTART:20240112T120000Z
SUMMARY:summary1
BEGIN:VEVENT
SUMMARY:summary2
DTSTART:20240112T120000Z
DTEND:20240112T130000Z
DTSTAMP:20240108T160153Z
UID:1704729713/asdf@redacted.org
ATTENDEE;CN="abc";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTIC
  IPANT;RSVP=TRUE:MAILTO:participant1@redacted.org
ATTENDEE;CN="def";CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTIC
  IPANT;RSVP=TRUE:MAILTO:participant2@redacted.org
LOCATION:Office
ORGANIZER;CN="hij";ROLE=NON-PARTICIPANT:MAILTO:organizer@redacted.org
PRIORITY:5
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR

Read, parse and serialize again.

import ics

content = open("/tmp/invite.ics", "r").read()
cal = ics.Calendar(content) # able to parse it

filename_event = '/tmp/invite-new.ics'
with open(filename_event, 'w') as ics_file:
    ics_file.writelines(cal)

boom.

Traceback (most recent call last):
  File "~/test.py", line 9, in <module>
    ics_file.writelines(cal)
  File "~/python3.10/site-packages/ics/icalendar.py", line 107, in __iter__
    yield from self.serialize_iter()
  File "~/python3.10/site-packages/ics/component.py", line 81, in serialize_iter
    return self.serialize().splitlines(keepends=True)
  File "~/python3.10/site-packages/ics/component.py", line 72, in serialize
    output(self, container)
  File "~/python3.10/site-packages/ics/serializers/icalendar_serializer.py", line 27, in serialize_event
    container.append(event.serialize())
  File "~/python3.10/site-packages/ics/component.py", line 73, in serialize
    return str(container)
  File "~/python3.10/site-packages/ics/grammar/parse.py", line 119, in __str__
    ret.append(str(line))
  File "~/python3.10/site-packages/ics/grammar/parse.py", line 59, in __str__
    params_str += ';{}={}'.format(pname, ','.join(self.params[pname]))
TypeError: sequence item 0: expected str instance, bool found
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