Check all RRULE occurrences for infinity
This commit is contained in:
parent
34771f6850
commit
4252747646
@ -191,7 +191,7 @@ def visit_time_ranges(vobject_item: vobject.base.Component, child_name: str,
|
|||||||
datetimes and ``is_recurrence`` as arguments. If the function returns True,
|
datetimes and ``is_recurrence`` as arguments. If the function returns True,
|
||||||
the operation is cancelled.
|
the operation is cancelled.
|
||||||
|
|
||||||
``infinity_fn`` gets called when an infiite recurrence rule is detected
|
``infinity_fn`` gets called when an infinite recurrence rule is detected
|
||||||
with ``start`` datetime as argument. If the function returns True, the
|
with ``start`` datetime as argument. If the function returns True, the
|
||||||
operation is cancelled.
|
operation is cancelled.
|
||||||
|
|
||||||
@ -206,9 +206,13 @@ def visit_time_ranges(vobject_item: vobject.base.Component, child_name: str,
|
|||||||
|
|
||||||
def getrruleset(child: vobject.base.Component, ignore: Sequence[date]
|
def getrruleset(child: vobject.base.Component, ignore: Sequence[date]
|
||||||
) -> Tuple[Iterable[date], bool]:
|
) -> Tuple[Iterable[date], bool]:
|
||||||
if (hasattr(child, "rrule") and
|
infinite = False
|
||||||
";UNTIL=" not in child.rrule.value.upper() and
|
for rrule in child.contents.get("rrule", []):
|
||||||
";COUNT=" not in child.rrule.value.upper()):
|
if (";UNTIL=" not in child.rrule.value.upper() and
|
||||||
|
";COUNT=" not in child.rrule.value.upper()):
|
||||||
|
infinite = True
|
||||||
|
break
|
||||||
|
if infinite:
|
||||||
for dtstart in child.getrruleset(addRDate=True):
|
for dtstart in child.getrruleset(addRDate=True):
|
||||||
if dtstart in ignore:
|
if dtstart in ignore:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user