From 9b26e188f120d3f9ae5e1d4aed833b4795852ffb Mon Sep 17 00:00:00 2001 From: "Kamil Mankowski (kam193)" Date: Wed, 18 Mar 2020 20:03:07 +0100 Subject: [PATCH 1/2] Default type vText when converting vRecur to ical Use default type when converting recurence definition to ical string. --- CHANGES.rst | 1 + docs/credits.rst | 1 + src/icalendar/prop.py | 2 +- src/icalendar/tests/test_unit_prop.py | 5 +++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7fbaa93a..4e62e5ec 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,6 +15,7 @@ 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] 4.0.4 (2019-11-25) diff --git a/docs/credits.rst b/docs/credits.rst index d1ee2a97..420af8d4 100644 --- a/docs/credits.rst +++ b/docs/credits.rst @@ -55,6 +55,7 @@ icalendar contributors - Andreas Ruppen - Clive Stevens - Dalton Durst +- Kamil MaƄkowski Find out who contributed:: diff --git a/src/icalendar/prop.py b/src/icalendar/prop.py index 23fab24f..2c6ae858 100644 --- a/src/icalendar/prop.py +++ b/src/icalendar/prop.py @@ -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) diff --git a/src/icalendar/tests/test_unit_prop.py b/src/icalendar/tests/test_unit_prop.py index cc9ea536..a9ee27aa 100644 --- a/src/icalendar/tests/test_unit_prop.py +++ b/src/icalendar/tests/test_unit_prop.py @@ -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 From 3fc1007e60de9b01ec34c55a63a99447e615acb4 Mon Sep 17 00:00:00 2001 From: "Kamil Mankowski (kam193)" Date: Thu, 16 Jan 2020 21:00:59 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 4e62e5ec..560ebae8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,6 +16,7 @@ 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)