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

Default type vText when converting vRecur to ical #299

Merged
merged 2 commits into from Apr 8, 2020
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
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -15,6 +15,8 @@ New features:
Bug fixes:

- Fixed a docs issue related to building on Read the Docs [davidfischer]
- Use ``vText`` as default type, when convert recurrence definition to ical string. [kam193]
- Enable CI for Python 3.7 and more reduce Hypothesis iteration due to CI timeout. [kam193]


4.0.4 (2019-11-25)
Expand Down
1 change: 1 addition & 0 deletions docs/credits.rst
Expand Up @@ -55,6 +55,7 @@ icalendar contributors
- Andreas Ruppen <andreas.ruppen@gmail.com>
- Clive Stevens <clivest2@gmail.com>
- Dalton Durst <github@daltondur.st>
- Kamil Mańkowski <kam193@wp.pl>

Find out who contributed::

Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/prop.py
Expand Up @@ -673,7 +673,7 @@ def __init__(self, *args, **kwargs):
def to_ical(self):
result = []
for key, vals in self.sorted_items():
typ = self.types[key]
typ = self.types.get(key, vText)
if not isinstance(vals, SEQUENCE_TYPES):
vals = [vals]
vals = b','.join(typ(val).to_ical() for val in vals)
Expand Down
5 changes: 5 additions & 0 deletions src/icalendar/tests/test_unit_prop.py
Expand Up @@ -332,6 +332,11 @@ def test_prop_vRecur(self):
# and some errors
self.assertRaises(ValueError, vRecur.from_ical, 'BYDAY=12')

# when key is not RFC-compliant, parse it as vText
r = vRecur.from_ical('FREQ=MONTHLY;BYOTHER=TEXT;BYEASTER=-3')
self.assertEqual(vRecur(r).to_ical(),
b'FREQ=MONTHLY;BYEASTER=-3;BYOTHER=TEXT')

def test_prop_vText(self):
from ..prop import vText

Expand Down