[Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.20,1.21

Guido van Rossum python-dev@python.org
Wed, 9 Aug 2000 20:05:30 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv5004

Modified Files:
	mailbox.py 
Log Message:
Improve MHMailbox: messages are now sorted in numerical order.
Also don't allow leading zeros in message numbers.


Index: mailbox.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** mailbox.py	2000/07/09 16:44:26	1.20
--- mailbox.py	2000/08/10 03:05:26	1.21
***************
*** 156,166 ****
      def __init__(self, dirname):
          import re
!         pat = re.compile('^[0-9][0-9]*$')
          self.dirname = dirname
          files = os.listdir(self.dirname)
!         self.boxes = []
          for f in files:
              if pat.match(f):
!                 self.boxes.append(f)
  
      def next(self):
--- 156,171 ----
      def __init__(self, dirname):
          import re
!         pat = re.compile('^[1-9][0-9]*$')
          self.dirname = dirname
          files = os.listdir(self.dirname)
!         list = []
          for f in files:
              if pat.match(f):
!                 list.append(f)
!         list = map(long, list)
!         list.sort()
!         # This only works in Python 1.6 or later;
!         # before that str() added 'L':
!         self.boxes = map(str, list)
  
      def next(self):