From 3e6b49ad2913680343cc4c27d86eb2c0c4bc6190 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sat, 13 Feb 2010 13:52:12 -0800 Subject: Fixed a bug in pipermail archiving that caused fallback threading by subject to fail. Bug #266572. --- Mailman/Archiver/HyperDatabase.py | 22 ++++++++++++++-------- Mailman/Archiver/pipermail.py | 8 ++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'Mailman/Archiver') diff --git a/Mailman/Archiver/HyperDatabase.py b/Mailman/Archiver/HyperDatabase.py index 28671740..1de58d6f 100644 --- a/Mailman/Archiver/HyperDatabase.py +++ b/Mailman/Archiver/HyperDatabase.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2010 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. # # site modules @@ -138,9 +139,14 @@ class DumbBTree: return self.dict.has_key(key) def set_location(self, loc): - if not self.dict.has_key(loc): - raise KeyError - self.current_index = self.sorted.index(loc) + index = 0 + self.__sort() + for key in self.sorted: + if key[0] == loc: + self.current_index = index + return key,self.dict[key] + index = index + 1 + raise KeyError(loc) def __getitem__(self, item): return self.dict[item] @@ -311,9 +317,9 @@ class HyperDatabase(pipermail.Database): self.__openIndices(archive) subject = subject.lower() try: - key, tempid=self.subjectIndex.set_location(subject) - self.subjectIndex.next() - [subject2, date]= key.split('\0') + self.subjectIndex.set_location(subject) + key, tempid = self.subjectIndex.next() + [subject2, date]= key[:2] if subject!=subject2: return None return tempid except KeyError: diff --git a/Mailman/Archiver/pipermail.py b/Mailman/Archiver/pipermail.py index cfa4301e..3e5ead66 100644 --- a/Mailman/Archiver/pipermail.py +++ b/Mailman/Archiver/pipermail.py @@ -664,8 +664,12 @@ class T: else: # Get the oldest article with a matching subject, and # assume this is a follow-up to that article - parentID = self.database.getOldestArticle(archive, - article.subject) + # But, use the subject that's in the database + if article.decoded.has_key('stripped'): + subject = article.decoded['stripped'].lower() + else: + subject = article.subject.lower() + parentID = self.database.getOldestArticle(archive, subject) if parentID and not self.database.hasArticle(archive, parentID): parentID = None -- cgit v1.2.3