1.1 --- a/imiptools/handlers/scheduling/quota.py Mon Feb 08 20:18:15 2016 +0100
1.2 +++ b/imiptools/handlers/scheduling/quota.py Mon Feb 08 22:03:57 2016 +0100
1.3 @@ -75,6 +75,11 @@
1.4 total = _get_duration(handler)
1.5 expiry = _get_expiry_time(handler)
1.6
1.7 + # Reject indefinitely recurring events.
1.8 +
1.9 + if total == Endless() or not expiry:
1.10 + return
1.11 +
1.12 # Obtain the journal entries and limits.
1.13
1.14 journal = handler.get_journal()
1.15 @@ -94,6 +99,11 @@
1.16
1.17 total = _get_duration(handler)
1.18
1.19 + # Reject indefinitely recurring events.
1.20 +
1.21 + if total == Endless():
1.22 + return
1.23 +
1.24 # Obtain the journal entries and limits.
1.25
1.26 journal = handler.get_journal()
1.27 @@ -127,12 +137,16 @@
1.28
1.29 "Return the duration of the current object provided by the 'handler'."
1.30
1.31 - # Count only explicit periods.
1.32 - # NOTE: Should reject indefinitely recurring events.
1.33 + # Reject indefinitely recurring events.
1.34 +
1.35 + if handler.obj.possibly_recurring_indefinitely():
1.36 + return Endless()
1.37 +
1.38 + # Otherwise, return a sum of the period durations.
1.39
1.40 total = timedelta(0)
1.41
1.42 - for period in handler.get_periods(handler.obj, explicit_only=True):
1.43 + for period in handler.get_periods(handler.obj):
1.44 duration = period.get_duration()
1.45
1.46 # Decline events whose period durations are endless.
1.47 @@ -151,10 +165,12 @@
1.48 the 'handler'.
1.49 """
1.50
1.51 - # Count only explicit periods.
1.52 - # NOTE: Should reject indefinitely recurring events.
1.53 + # Reject indefinitely recurring events.
1.54
1.55 - periods = handler.get_periods(handler.obj, explicit_only=True)
1.56 + if handler.obj.possibly_recurring_indefinitely():
1.57 + return None
1.58 +
1.59 + periods = handler.get_periods(handler.obj)
1.60 return periods and to_utc_datetime(periods[-1].get_end_point()) or None
1.61
1.62 def _get_usage(entries):