diff options
author | Jochen Sprickerhof <jspricke@debian.org> | 2023-02-05 09:16:45 +0100 |
---|---|---|
committer | Jochen Sprickerhof <jspricke@debian.org> | 2023-02-05 09:16:45 +0100 |
commit | c5897c34994636d01ce852e1dae52abb252fd5fb (patch) | |
tree | c815a4843db21725074915495dc70fef25d3737f | |
parent | 61dde036ac48ac1cdf8d41ab652b58f76fd4bfb8 (diff) | |
parent | b2e11a4237dbcfc57f08c716d564faf5dd303992 (diff) |
Update upstream source from tag 'upstream/2.0.1'
Update to upstream version '2.0.1'
with Debian dir 6ba4be0cb50c6694d090fee4650ce5034cd4a682
-rw-r--r-- | README.rst | 4 | ||||
-rw-r--r-- | recurring_ical_events.py | 7 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | test/calendars/duplicated_rrule.ics | 16 | ||||
-rw-r--r-- | test/test_repeated_properties.py | 4 |
5 files changed, 32 insertions, 1 deletions
@@ -276,6 +276,10 @@ how to go about it. Changelog --------- +- v2.0.1 + + - Fixed crasher with duplicate RRULE. See `Pull Request 104 <https://github.com/niccokunzmann/python-recurring-ical-events/pull/104>`_ + - v2.0.0b - Only return ``VEVENT`` by default. Add ``of(... ,components=...)`` parameter to select which kinds of components should be returned. See `Issue 101 <https://github.com/niccokunzmann/python-recurring-ical-events/issues/101>`_. diff --git a/recurring_ical_events.py b/recurring_ical_events.py index ab7d7de..d3bcf01 100644 --- a/recurring_ical_events.py +++ b/recurring_ical_events.py @@ -186,6 +186,13 @@ class RepeatedComponent: self.rule = rule = rruleset(cache=True) _rule = component.get("RRULE", None) if _rule: + # We don't support multiple RRULE yet, but we can support cases + # where the same RRULE is erroneously repeated + if isinstance(_rule, list): + if len(_rule) > 0 and all(part == _rule[0] for part in _rule): + _rule = _rule[0] + else: + raise ValueError("Don't yet support multiple distinct RRULE properties") self.rrule = self.create_rule_with_start(_rule.to_ical().decode()) rule.rrule(self.rrule) else: @@ -11,7 +11,7 @@ PACKAGE_NAME = "recurring_ical_events" HERE = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, HERE) # for package import -__version__ = "2.0.0" +__version__ = "2.0.1" __author__ = 'Nicco Kunzmann' diff --git a/test/calendars/duplicated_rrule.ics b/test/calendars/duplicated_rrule.ics new file mode 100644 index 0000000..fc26f45 --- /dev/null +++ b/test/calendars/duplicated_rrule.ics @@ -0,0 +1,16 @@ +BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CyrusIMAP.org/Cyrus
+ 3.9.0-alpha0-85-gd6d859e0cf-fm-20230116.001-gd6d859e0//EN
+BEGIN:VEVENT
+CREATED:20230109T084023Z
+LAST-MODIFIED:20230119T110732Z
+DTSTAMP:20230119T110732Z
+UID:56cdc4dc-11b7-407c-86c6-9faedfc28afb
+SUMMARY:My repeating event
+RRULE:FREQ=WEEKLY;BYDAY=TH;COUNT=20
+RRULE:FREQ=WEEKLY;BYDAY=TH;COUNT=20
+DTSTART;TZID=Europe/London:20230112T100000
+DTEND;TZID=Europe/London:20230112T120000
+END:VEVENT
+END:VCALENDAR
diff --git a/test/test_repeated_properties.py b/test/test_repeated_properties.py new file mode 100644 index 0000000..e247de6 --- /dev/null +++ b/test/test_repeated_properties.py @@ -0,0 +1,4 @@ + +def test_duplicated_rrule(calendars): + # Test that a repetition of the same `RRULE` property should be ignored + assert len(calendars.duplicated_rrule.at(2023)) == 20 |