summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-04-04 03:31:39 (GMT)
committerGuido van Rossum <guido@python.org>2000-04-04 03:31:39 (GMT)
commit1571a1e34b68f0f3384ced27ee692e200d219a9e (patch)
treea08f676019321158a64b23c03bfb7871ab48b8c9
parentaebf706b4e845d7525d2d8e792f0e23fcfb3e6af (diff)
downloadcpython-1571a1e34b68f0f3384ced27ee692e200d219a9e.zip
cpython-1571a1e34b68f0f3384ced27ee692e200d219a9e.tar.gz
cpython-1571a1e34b68f0f3384ced27ee692e200d219a9e.tar.bz2
Since Thomas Wouters kept complaining that he wants access to the the
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.
-rwxr-xr-xLib/mailbox.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 6d5f6e4..b6c16fe 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -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()