# HG changeset patch # User Paul Boddie # Date 1454970249 -3600 # Node ID 5abe3fb608d67ccdc38fcb68c508ccf13f5ef8d1 # Parent 95dcb22905cc1aaf40f5a6834fc06f911f16dee1 Allow the retraction of events even if the event durations do not match. diff -r 95dcb22905cc -r 5abe3fb608d6 imiptools/handlers/scheduling/quota.py --- a/imiptools/handlers/scheduling/quota.py Mon Feb 08 22:43:55 2016 +0100 +++ b/imiptools/handlers/scheduling/quota.py Mon Feb 08 23:24:09 2016 +0100 @@ -99,10 +99,10 @@ total = _get_duration(handler) - # Reject indefinitely recurring events. + # Allow indefinitely recurring events. if total == Endless(): - return + total = None # Obtain the journal entries and limits. @@ -193,7 +193,7 @@ 'recurrenceid' with the given 'duration' and 'expiry' time. """ - confirmed = _find_applicable_entry(entries, uid, recurrenceid, duration) + confirmed = _find_applicable_entry(entries, uid, recurrenceid) # Where a previous entry still applies, retract it if different. @@ -216,22 +216,22 @@ 'uid' and 'recurrenceid' with the given 'duration'. """ - confirmed = _find_applicable_entry(entries, uid, recurrenceid, duration) + confirmed = _find_applicable_entry(entries, uid, recurrenceid) # Where a previous entry still applies, retract it. if confirmed: found_uid, found_recurrenceid, found_duration, found_expiry = confirmed entries.append((found_uid, found_recurrenceid, "-%s" % found_duration, found_expiry)) - return found_duration == duration + return True return False -def _find_applicable_entry(entries, uid, recurrenceid, duration): +def _find_applicable_entry(entries, uid, recurrenceid): """ Within 'entries', find any applicable previous entry for this event, - using the 'uid', 'recurrenceid' and 'duration'. + using the 'uid' and 'recurrenceid'. """ confirmed = None