]> granicus.if.org Git - python/commitdiff
Maildir.__init__(): Use the correct filter for filenames, so that this
authorFred Drake <fdrake@acm.org>
Fri, 22 Sep 2000 18:41:50 +0000 (18:41 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 22 Sep 2000 18:41:50 +0000 (18:41 +0000)
                     class conforms to the maildir specification.

Lib/mailbox.py

index 5c6cc8874d8da26d254d02691ed68074419968ad..f0107772bf6abfb43f8e91026200d3a2ac60ef93 100755 (executable)
@@ -182,19 +182,16 @@ class Maildir:
     def __init__(self, dirname):
         import string
         self.dirname = dirname
-        self.boxes = []
 
         # check for new mail
         newdir = os.path.join(self.dirname, 'new')
-        for file in os.listdir(newdir):
-            if len(string.split(file, '.')) > 2:
-                self.boxes.append(os.path.join(newdir, file))
+        boxes = [os.path.join(newdir, f)
+                 for f in os.listdir(newdir) if f[0] != '.']
 
         # Now check for current mail in this maildir
         curdir = os.path.join(self.dirname, 'cur')
-        for file in os.listdir(curdir):
-            if len(string.split(file, '.')) > 2:
-                self.boxes.append(os.path.join(curdir, file))
+        boxes += [os.path.join(curdir, f)
+                  for f in os.listdir(curdir) if f[0] != '.']
 
     def next(self):
         if not self.boxes: