[issue11935] MMDF/MBOX mailbox need utime

Steffen Daode Nurpmeso report at bugs.python.org
Mon May 2 13:03:30 CEST 2011


Steffen Daode Nurpmeso <sdaoden at googlemail.com> added the comment:

I'll attach a patch with a clearer comment (entry-gate instead
"new mail"), i.e. the comment now reflects what MUAs really do.

----------
Added file: http://bugs.python.org/file21850/11935.2.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11935>
_______________________________________
-------------- next part --------------
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -692,6 +692,13 @@
         self._file = open(self._path, 'rb+')
         self._toc = new_toc
         self._pending = False
+        # Set modification time to be after access time so that MMDF and MBOX
+        # mail readers detect changes (or perform further inspection to do so)
+        try:
+            currtime = time.time()
+            os.utime(self._path, (currtime-3, currtime))
+        except:
+            pass
         if self._locked:
             _lock_file(self._file, dotlock=False)
 


More information about the Python-bugs-list mailing list