[Mailman-Developers] pending.db dumper
Dan Mick
Dan Mick <dmick@utopia.West.Sun.COM>
Wed, 30 Jan 2002 00:13:21 -0800 (PST)
Here's a short Python hack to dump the pending.db database in
a slightly-more-useful (to me at least) format: sorted by
expiry ('eviction') date, with key, eviction date, and item tuple
on a separate line. Again, any and all comments welcome.
Meant to be run from ~mailman.
#!/usr/bin/env python
from Mailman import Pending
import time
db = Pending._load()
def sortfunc(i1, i2):
(c1, d1) = i1
(c2, d2) = i2
if (d1 < d2): return -1
if (d1 == d2): return 0
if (d1 > d2): return 1
ev = db['evictions']
evtuples = map(None, ev.keys(), ev.values())
evtuples.sort(sortfunc)
for k, d in evtuples:
print k, time.ctime(d)
print "\t", db[k]