Skip to content

Commit

Permalink
Merge pull request #299 from kam193/master
Browse files Browse the repository at this point in the history
Default type vText when converting vRecur to ical
  • Loading branch information
mauritsvanrees committed Apr 8, 2020
2 parents 3258ea9 + 3fc1007 commit c5f5602
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Bug fixes:
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit c5f5602

Please sign in to comment.