~joostvb/mailman/2.1-pgp-smime

« back to all changes in this revision

Viewing changes to Mailman/Archiver/HyperDatabase.py

  • Committer: Joost van Baal
  • Date: 2010-03-01 10:14:35 UTC
  • mfrom: (414.13.93 2.1)
  • Revision ID: joostvb-bzr@mdcc.cx-20100301101435-2tsrm9hg4wydfai8
merging with upstream: 2.1.14 is coming

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 1998-2010 by the Free Software Foundation, Inc.
2
2
#
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
16
# USA.
16
17
 
17
18
#
18
19
# site modules
138
139
        return self.dict.has_key(key)
139
140
 
140
141
    def set_location(self, loc):
141
 
        if not self.dict.has_key(loc):
142
 
            raise KeyError
143
 
        self.current_index = self.sorted.index(loc)
 
142
        index = 0
 
143
        self.__sort()
 
144
        for key in self.sorted:
 
145
            if key[0] == loc:
 
146
                self.current_index = index
 
147
                return key,self.dict[key]
 
148
            index = index + 1
 
149
        raise KeyError(loc)
144
150
 
145
151
    def __getitem__(self, item):
146
152
        return self.dict[item]
311
317
        self.__openIndices(archive)
312
318
        subject = subject.lower()
313
319
        try:
314
 
            key, tempid=self.subjectIndex.set_location(subject)
315
 
            self.subjectIndex.next()
316
 
            [subject2, date]= key.split('\0')
 
320
            self.subjectIndex.set_location(subject)
 
321
            key, tempid = self.subjectIndex.next()
 
322
            [subject2, date]= key[:2]
317
323
            if subject!=subject2: return None
318
324
            return tempid
319
325
        except KeyError: