]> granicus.if.org Git - python/commitdiff
Since Thomas Wouters kept complaining that he wants access to the the
authorGuido van Rossum <guido@python.org>
Tue, 4 Apr 2000 03:31:39 +0000 (03:31 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 4 Apr 2000 03:31:39 +0000 (03:31 +0000)
Unix From lines, change the UnixMailbox class so that _search_start()
positions the file *before* the Unix From line instead of after it;
change _search_end() to skip one line before looking for the next From
line.  The rfc822.Message class automatically recognizes these Unix
From lines and squirrels them away in the 'unixfrom' instance variable.

Lib/mailbox.py

index 6d5f6e499a103202a3633ea4eb52da4660a75757..b6c16fe1d6945e9d58ee53bf081bf297d0a9ef8d 100755 (executable)
@@ -97,13 +97,16 @@ class UnixMailbox(_Mailbox):
 
         def _search_start(self):
                 while 1:
+                       pos = self.fp.tell()
                         line = self.fp.readline()
                         if not line:
                                 raise EOFError
                         if line[:5] == 'From ' and self._isrealfromline(line):
+                               self.fp.seek(pos)
                                 return
 
         def _search_end(self):
+               self.fp.readline()      # Throw away header line
                 while 1:
                         pos = self.fp.tell()
                         line = self.fp.readline()