From 0e0fdc574d23bc1af0c570318d6028aeb0277561 Mon Sep 17 00:00:00 2001 From: jaca Date: Thu, 15 Dec 2022 20:05:22 +0100 Subject: [PATCH 1/4] add test case from issue #500 --- src/icalendar/tests/events/event_with_rsvp.ics | 3 +++ .../tests/test_issue_500_vboolean_for_parameter.py | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 src/icalendar/tests/events/event_with_rsvp.ics create mode 100644 src/icalendar/tests/test_issue_500_vboolean_for_parameter.py diff --git a/src/icalendar/tests/events/event_with_rsvp.ics b/src/icalendar/tests/events/event_with_rsvp.ics new file mode 100644 index 00000000..01963d5b --- /dev/null +++ b/src/icalendar/tests/events/event_with_rsvp.ics @@ -0,0 +1,3 @@ +BEGIN:VEVENT +ATTENDEE;RSVP=TRUE:mailto:someone@example.com +END:VEVENT diff --git a/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py b/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py new file mode 100644 index 00000000..2c67883a --- /dev/null +++ b/src/icalendar/tests/test_issue_500_vboolean_for_parameter.py @@ -0,0 +1,9 @@ +from icalendar import Event, vBoolean, vCalAddress + +def test_vBoolean_can_be_used_as_parameter_issue_500(events): + '''https://github.com/collective/icalendar/issues/500''' + attendee = vCalAddress(f'mailto:someone@example.com') + attendee.params['rsvp'] = vBoolean(True) + event = Event() + event.add('attendee', attendee) + assert event.to_ical() == events.event_with_rsvp.raw_ics From b47aba5400098ab620dd54211c45a5f5fb9602e3 Mon Sep 17 00:00:00 2001 From: jaca Date: Thu, 15 Dec 2022 20:37:57 +0100 Subject: [PATCH 2/4] alaways pass string representation of calendar object to dquote --- src/icalendar/parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/icalendar/parser.py b/src/icalendar/parser.py index 47f0b684..0ad2e110 100644 --- a/src/icalendar/parser.py +++ b/src/icalendar/parser.py @@ -102,7 +102,10 @@ def param_value(value): """ if isinstance(value, SEQUENCE_TYPES): return q_join(value) - return dquote(value) + elif isinstance(value, str): + return dquote(value) + else: + return dquote(value.to_ical().decode(DEFAULT_ENCODING)) # Could be improved From 230c466b258e9ade1c85f9ad6ea65adaa5b494c3 Mon Sep 17 00:00:00 2001 From: jaca Date: Thu, 15 Dec 2022 20:49:43 +0100 Subject: [PATCH 3/4] add changelog entry for #501 --- CHANGES.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 81212680..ad63ed50 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -18,7 +18,10 @@ New features: Bug fixes: -- ... +- vBoolean can now be used as an parameter + Ref: #501 + Fixes: #500 + [jacadzaca] 5.0.3 (2022-11-23) From d8b5e34176829d1fdec57a0db24dbd355279e56f Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Thu, 15 Dec 2022 22:05:42 +0100 Subject: [PATCH 4/4] Fixed plone tox environment when using latest tox 4. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 3a13fd5c..c6f4a3a3 100644 --- a/tox.ini +++ b/tox.ini @@ -32,7 +32,7 @@ commands_pre = # Install Plone and explicitly the single package that uses icalendar, plus the test runner. pip install Plone plone.app.event[test] zope.testrunner -c https://dist.plone.org/release/6.0-dev/constraints.txt # Install the dev version of the package, mostly so we can safely point to the path with the tests. - pip install -e "git+https://github.com/plone/plone.app.event.git#egg=plone.app.event" + pip install -e "git+https://github.com/plone/plone.app.event.git\#egg=plone.app.event" # icalendar is pinned in the constraints, but we want the current dev version. pip install -e {toxinidir} commands =