Update of /cvsroot/mailman/mailman/Mailman/Archiver
In directory usw-pr-cvs1:/tmp/cvs-serv23117/Mailman/Archiver

Modified Files:
        pipermail.py 
Log Message:
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.


Index: pipermail.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/pipermail.py,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -d -r2.12 -r2.13
*** pipermail.py        2 Jan 2002 01:59:18 -0000       2.12
--- pipermail.py        16 Mar 2002 02:08:22 -0000      2.13
***************
*** 521,527 ****
      # object will then be archived.
      
!     def processUnixMailbox(self, input, articleClass = Article):
        mbox = ArchiverMailbox(input, self.maillist)
          counter = 0
        while 1:
              try:
--- 521,538 ----
      # object will then be archived.
      
!     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:
***************
*** 531,540 ****
            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.add_article(a)
  
      def new_archive(self, archive, archivedir):
--- 542,553 ----
            if not m:
                  break
              msgid = m.get('message-id', 'n/a')
              self.message(_('#%(counter)05d %(msgid)s'))
            a = articleClass(m, self.sequence)
!           self.sequence += 1
            self.add_article(a)
+             if end is not None and counter >= end:
+                break
+             counter += 1
  
      def new_archive(self, archive, archivedir):


_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to