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

Fix 500 #501

Merged
merged 4 commits into from Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGES.rst
Expand Up @@ -18,7 +18,10 @@ New features:

Bug fixes:

- ...
- vBoolean can now be used as an parameter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fix covers all the property types... vInt, vTime, etc

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're probably right, but I don't put things in the changelog if there isn't a corresponding test for the entry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you put it in the changelog, it creates an expectation and then people come back if this is not the case. But since it is in the documentation, the expectation is there either way.

Ref: #501
Fixes: #500
[jacadzaca]


5.0.3 (2022-11-23)
Expand Down
5 changes: 4 additions & 1 deletion src/icalendar/parser.py
Expand Up @@ -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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The None return is interesting. When does it hit?



# Could be improved
Expand Down
3 changes: 3 additions & 0 deletions src/icalendar/tests/events/event_with_rsvp.ics
@@ -0,0 +1,3 @@
BEGIN:VEVENT
ATTENDEE;RSVP=TRUE:mailto:someone@example.com
END:VEVENT
9 changes: 9 additions & 0 deletions 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):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be tests for some of the other types or is that excessive? Basically everything with an .to_ical() method works and I'm assuming there's test already for those methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are tests for proper encoding for other v types, but I don't think there are any for checking if they can be used as a param. If you've got the time to file a PR with a parametrization of this test for other v types I'll gladly accept it :) if you don't, I will try to update the test sometime next week :)

'''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
2 changes: 1 addition & 1 deletion tox.ini
Expand Up @@ -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 =
Expand Down