[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/mail/ Changed Maildir code to ignore files starting with a dot. This is recommended

Marius Gedminas marius at pov.lt
Wed Jul 7 08:05:49 EDT 2004


Log message for revision 26150:
Changed Maildir code to ignore files starting with a dot.  This is recommended
by http://www.qmail.org/man/man5/maildir.html, and it also stops bugtracker
from complaining that $ZOPE3_HOME/src/bugtracker/mail-queue/new/.svn is a
directory every 3 seconds.




-=-
Modified: Zope3/trunk/src/zope/app/mail/maildir.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/maildir.py	2004-07-07 10:55:53 UTC (rev 26149)
+++ Zope3/trunk/src/zope/app/mail/maildir.py	2004-07-07 12:05:49 UTC (rev 26150)
@@ -60,12 +60,14 @@
         join = os.path.join
         subdir_cur = join(self.path, 'cur')
         subdir_new = join(self.path, 'new')
-        new_messages = [join(subdir_new, x) for x in os.listdir(subdir_new)]
-        cur_messages = [join(subdir_cur, x) for x in os.listdir(subdir_cur)]
-        # XXX http://www.qmail.org/man/man5/maildir.html says:
+        # http://www.qmail.org/man/man5/maildir.html says:
         #     "It is a good idea for readers to skip all filenames in new
         #     and cur starting with a dot.  Other than this, readers
         #     should not attempt to parse filenames."
+        new_messages = [join(subdir_new, x) for x in os.listdir(subdir_new)
+                        if not x.startswith('.')]
+        cur_messages = [join(subdir_cur, x) for x in os.listdir(subdir_cur)
+                        if not x.startswith('.')]
         return iter(new_messages + cur_messages)
 
     def newMessage(self):

Modified: Zope3/trunk/src/zope/app/mail/tests/test_maildir.py
===================================================================
--- Zope3/trunk/src/zope/app/mail/tests/test_maildir.py	2004-07-07 10:55:53 UTC (rev 26149)
+++ Zope3/trunk/src/zope/app/mail/tests/test_maildir.py	2004-07-07 12:05:49 UTC (rev 26150)
@@ -73,9 +73,9 @@
         '/path/to/emptydirectory': stat.S_IFDIR,
     }
     _listdir = {
-        '/path/to/maildir/new': ['1', '2'],
-        '/path/to/maildir/cur': ['2', '1'],
-        '/path/to/maildir/tmp': ['1', '2'],
+        '/path/to/maildir/new': ['1', '2', '.svn'],
+        '/path/to/maildir/cur': ['2', '1', '.tmp'],
+        '/path/to/maildir/tmp': ['1', '2', '.ignore'],
     }
 
     path = FakeOsPathModule(_stat_mode, _listdir)



More information about the Zope3-Checkins mailing list