diff options
| author | jhylton | 2000-09-22 20:28:15 +0000 |
|---|---|---|
| committer | jhylton | 2000-09-22 20:28:15 +0000 |
| commit | 327e563a2576ae52468d8001afb14c599ac2de26 (patch) | |
| tree | db07661612c7f1aa7336dec41a927b339c9efa16 | |
| parent | ad4ba52f694b2f026be863ab869b8d7ca83ab03c (diff) | |
| download | mailman-327e563a2576ae52468d8001afb14c599ac2de26.tar.gz mailman-327e563a2576ae52468d8001afb14c599ac2de26.tar.zst mailman-327e563a2576ae52468d8001afb14c599ac2de26.zip | |
| -rw-r--r-- | Mailman/Archiver/HyperDatabase.py | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/Mailman/Archiver/HyperDatabase.py b/Mailman/Archiver/HyperDatabase.py index c49b487be..b59a9e981 100644 --- a/Mailman/Archiver/HyperDatabase.py +++ b/Mailman/Archiver/HyperDatabase.py @@ -30,8 +30,6 @@ import errno import pipermail from Mailman import LockFile from Mailman.Utils import mkdir, open_ex -# TBD: ugly, ugly, ugly -baw -open = open_ex CACHESIZE = pipermail.CACHESIZE @@ -67,20 +65,8 @@ class DumbBTree: self.__dirty = 0 self.dict = {} self.sorted = [] - try: - fp = open(path) - try: - self.dict = marshal.load(fp) - finally: - fp.close() - except IOError, e: - if e.errno <> errno.ENOENT: raise - pass - except EOFError: - pass - else: - self.__sort(dirty=1) - + self.load() + def __repr__(self): return "DumbBTree(%s)" % self.path @@ -180,8 +166,23 @@ class DumbBTree: def __len__(self): return len(self.sorted) + def load(self): + try: + fp = open_ex(self.path) + try: + self.dict = marshal.load(fp) + finally: + fp.close() + except IOError, e: + if e.errno <> errno.ENOENT: raise + pass + except EOFError: + pass + else: + self.__sort(dirty=1) + def close(self): - fp = open(self.path, "w") + fp = open_ex(self.path, "w") fp.write(marshal.dumps(self.dict)) fp.close() self.unlock() @@ -315,7 +316,6 @@ class HyperDatabase(pipermail.Database): def clearIndex(self, archive, index): self.__openIndices(archive) -## index=getattr(self, index+'Index') if hasattr(self.threadIndex, 'clear'): self.threadIndex.clear() return @@ -328,14 +328,3 @@ class HyperDatabase(pipermail.Database): try: key, msgid=self.threadIndex.next() except KeyError: finished=1 - - - - - - - - - - - |
