diff options
| author | bwarsaw | 2002-03-16 02:08:22 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-03-16 02:08:22 +0000 |
| commit | 72d5c01f46bfad049efbaf8b7575b391bd45065e (patch) | |
| tree | 0cf5bc40612ad5fb8359b93517c5c5c0dee021d0 /Mailman/Archiver/pipermail.py | |
| parent | 233a7b19cf70c0036b5b66b22f6ed6dd60ea75ae (diff) | |
| download | mailman-72d5c01f46bfad049efbaf8b7575b391bd45065e.tar.gz mailman-72d5c01f46bfad049efbaf8b7575b391bd45065e.tar.zst mailman-72d5c01f46bfad049efbaf8b7575b391bd45065e.zip | |
processUnixMailbox(): Add optional start and end arguments so that we
can fast forward past a bunch of messages in the mailbox. This will
be used by bin/arch to process a huge .mbox file in chunks (manually).
Not fully tested, but it seems to work.
Diffstat (limited to 'Mailman/Archiver/pipermail.py')
| -rw-r--r-- | Mailman/Archiver/pipermail.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Mailman/Archiver/pipermail.py b/Mailman/Archiver/pipermail.py index 5a3f827d5..7e49fcb36 100644 --- a/Mailman/Archiver/pipermail.py +++ b/Mailman/Archiver/pipermail.py @@ -520,9 +520,20 @@ class T: # and create a series of Article objects. Each article # object will then be archived. - def processUnixMailbox(self, input, articleClass = Article): + def processUnixMailbox(self, input, articleClass=Article, + start=None, end=None): mbox = ArchiverMailbox(input, self.maillist) + if start is None: + start = 0 counter = 0 + while counter < start: + try: + m = mbox.next() + except Errors.DiscardMessage: + continue + if not m: + return + counter += 1 while 1: try: m = mbox.next() @@ -530,12 +541,14 @@ class T: continue if not m: break - counter += 1 msgid = m.get('message-id', 'n/a') self.message(_('#%(counter)05d %(msgid)s')) a = articleClass(m, self.sequence) - self.sequence = self.sequence + 1 + self.sequence += 1 self.add_article(a) + if end is not None and counter >= end: + break + counter += 1 def new_archive(self, archive, archivedir): self.archives.append(archive) |
