1.1 --- a/tools/update_quotas.py Tue Feb 09 14:17:52 2016 +0100
1.2 +++ b/tools/update_quotas.py Tue Feb 09 15:01:40 2016 +0100
1.3 @@ -41,14 +41,13 @@
1.4 "Remove from 'entries' events that end at or before 'expiry'."
1.5
1.6 removed = []
1.7 + i = 0
1.8
1.9 - i = 0
1.10 while i < len(entries):
1.11 - uid, recurrenceid, duration, found_expiry = entry = entries[i]
1.12 - found_expiry = get_datetime(found_expiry)
1.13 + period = entries[i]
1.14
1.15 - if found_expiry <= expiry:
1.16 - removed.append(entry)
1.17 + if period.get_end_point() <= expiry:
1.18 + removed.append(period)
1.19 del entries[i]
1.20 else:
1.21 i += 1
1.22 @@ -87,8 +86,8 @@
1.23 removed = remove_expired_entries(entries, expiry)
1.24
1.25 if verbose:
1.26 - for entry in removed:
1.27 - print >>stderr, "Removed", entry
1.28 + for period in removed:
1.29 + print >>stderr, "\t".join(("Removed",) + period.as_tuple(strings_only=True))
1.30
1.31 # Store the processed entries.
1.32
1.33 @@ -98,8 +97,8 @@
1.34 # Alternatively, just write the entries to standard output.
1.35
1.36 else:
1.37 - for entry in entries:
1.38 - print >>stdout, "\t".join([(s or "") for s in entry])
1.39 + for period in entries:
1.40 + print >>stdout, "\t".join(period.as_tuple(strings_only=True))
1.41 finally:
1.42 journal.release_lock(quota)
1.43