Skip to content

Commit

Permalink
Merge pull request #32 from madsmtm/patch-1
Browse files Browse the repository at this point in the history
Fixed parsing when multiple `rrule`s are present
  • Loading branch information
irgangla authored Oct 24, 2018
2 parents 87ca2d1 + 45aa498 commit 007b3f3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions icalevents/icalparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,12 @@ def parse_rrule(component, tz=UTC):
:return: extracted rrule or rruleset
"""
if component.get('rrule'):
# Parse the rrule, might return a rruleset instance, instead of rrule
rule = rrulestr(component['rrule'].to_ical().decode(), dtstart=normalize(component['dtstart'].dt, tz=tz))
# component['rrule'] can be both a scalar and a list
rrules = component['rrule']
if not isinstance(rrules, list):
rrules = [rrules]
# Parse the rrules, might return a rruleset instance, instead of rrule
rule = rrulestr('\n'.join(x.to_ical().decode() for x in rrules), dtstart=normalize(component['dtstart'].dt, tz=tz))

if component.get('exdate'):
# Make sure, to work with a rruleset
Expand Down

0 comments on commit 007b3f3

Please sign in to comment.