Commit Graph

86 Commits

Author SHA1 Message Date
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Neil Schemenauer 03f3ee6d89 Try /var/mail before trying /usr/mail. Most new systems use /var.
This in inside the test so it really doesn't matter much.  Closes
SF patch 497097.
2002-03-24 01:38:38 +00:00
Barry Warsaw ffd05ee90d Added PortableUnixMailbox to the __all__ variable, and in the __main__
section use this class instead of UnixMailbox as per the comments in
the latter's class.

Bug fix candidate for 2.2.1.
2002-03-01 22:39:14 +00:00
Guido van Rossum 93a696f491 SF bug #461073: mailbox __iter__ bug, by Andrew Dalke.
Andrew quite correctly notices that the next() method isn't quite what
we need, since it returns None upon end instead of raising
StopIteration.  His fix is easy enough, using iter(self.next, None)
instead.
2001-09-13 01:29:13 +00:00
Guido van Rossum ef8f4dee07 Remove redundant imports (PyChecker). 2001-08-13 15:37:02 +00:00
Fred Drake 72987a4b96 Make the Mailbox objects support iteration -- they already had the
appropriate next() method, and this is what people really want to do with
these objects in practice.
2001-05-02 20:20:53 +00:00
Guido van Rossum 2b5ff073ab Get rid of the seek() method on the _Mailbox class. This was a
cut-and-paste copy of the seek() method on the _Subfile class, but it
didn't make one bit of sense: it sets self.pos, which is not used in
this class or its subclasses, and it uses self.start and self.stop,
which aren't defined on this class or its subclasses.  This is purely
my own fault -- I added this in rev 1.4 and apparently never tried to
use it.  Since it's not documented, and of very questionable use given
that there's no tell(), I'm ripping it out.

This resolves SF bug 416199 by Andrew Dalke: mailbox.py seek problems.
2001-04-15 13:32:27 +00:00
Barry Warsaw 81ad67cdc6 Two changes:
- All constructors grow an optional argument `factory' which is a
  callable used when new message instances are created by the next()
  methods.  Defaults to the rfc822.Message class.

- A new subclass of UnixMailbox is added, called PortableUnixMailbox.
  It's identical to UnixMailbox, but uses a more portable test for
  From_ delimiter lines.  With PortableUnixMailbox, any line that
  starts with "From " is considered a delimiter (this should really
  check for two newlines before the F, but it doesn't.
2001-01-31 22:13:15 +00:00
Skip Montanaro 17ab123cf1 a few more modules get __all__ 2001-01-24 06:27:27 +00:00
Fred Drake 8152d32375 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:20:45 +00:00
Fred Drake de3518e7ca Maildir.__init__(): Make sure self.boxes is set.
This closes SourceForge bug #117490.
2000-10-23 13:37:01 +00:00
Fred Drake cc4adf27f4 Add missing "s" from format string.
This closes SourceForge patch #101714.
2000-09-30 23:59:04 +00:00
Fred Drake d9a8dec135 Maildir.__init__(): Use the correct filter for filenames, so that this
class conforms to the maildir specification.
2000-09-22 18:41:50 +00:00
Fred Drake e108a02723 Detlef Lannert <lannert@uni-duesseldorf.de>:
mailbox.py (from the CVS tree) doesn't work with qmail Maildirs:
Filenames are completed when the directories are scanned, and
the directory name is prepended again in the next() method.

Another suggestion: Change the print statement in the _test()
driver to show two more date characters (probably the length
has increased due to the recent Y2K hype ;). Now it shows the
complete date, including the seconds -- at least for me. (I've
also made the sender field left justified, in case it is ever
shorter than the field width).
2000-09-14 14:44:43 +00:00
Sjoerd Mullender d2653a9e07 Use built in function filter instead of doing it laboriously by hand. 2000-08-11 07:48:36 +00:00
Guido van Rossum 0707fea5ee Improve MHMailbox: messages are now sorted in numerical order.
Also don't allow leading zeros in message numbers.
2000-08-10 03:05:26 +00:00
Fred Drake dbbf76bd5a Make tabnanny happy.
mailbox.py: Convert to 4-space indents.
2000-07-09 16:44:26 +00:00
Guido van Rossum 1571a1e34b 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.
2000-04-04 03:31:39 +00:00
Fred Drake 13a2c279c5 Untabify to pass the -tt test. 2000-02-10 17:17:14 +00:00
Guido van Rossum cd97576184 Only set msg.fp to None when there are no extra arguments; if there
are, we must keep the file around so we can print the body.
1999-12-14 22:18:37 +00:00
Guido van Rossum e256a0feed Add readlines() to _Subfile class. Not clear who would need it, but
Chris Lawrence sent me a broken version; this one is a tad simpler and
more conforming to the standard.
1999-03-24 16:20:45 +00:00
Guido van Rossum 9a4d63730e Patch by Mike Meyer:
Add a class to mailbox.py for dealing with qmail directory mailboxes.
The test code was extended to notice these being used as well.
1998-12-23 22:05:42 +00:00
Guido van Rossum 7333c4cafc Patch by Piet van Oostrum to avoid calculating with the result of
fp.tell() -- that won't work on Windows.

(A patch for rfc822 is still needed for one case where it finds a bad
header line and wants to back up.)
1998-07-20 15:24:01 +00:00
Guido van Rossum 8ba4036a40 The _fromlinepattern was a little too restrictive -- some sendmails
don't put the seconds in the time!
1998-07-02 23:05:32 +00:00
Guido van Rossum e50b0a44cb In class _Subfile, make sure read(n) can't read beyond EOF. Also
allow negative numbers to specify read until EOF (like for a regular
file's read() method).
1998-06-17 18:34:40 +00:00
Guido van Rossum fbe63de37d UnixMailbox: don't be fooled by lines that begin with "From " but
otherwise don't look like headers at all...
Also robustify the test code a bit.
1998-04-03 16:04:05 +00:00
Guido van Rossum 8ca842066c A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
Guido van Rossum 9694fcab53 Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
Guido van Rossum fdf58fe59a Added BabylMailbox class by Fred Lundh (untested). 1997-05-15 14:33:09 +00:00
Guido van Rossum 6dd87830d0 Improve getting the mailbox from the environment. 1997-05-08 23:11:52 +00:00
Guido van Rossum f06ee5fa07 /usr/local/bin/python -> /usr/bin/env python 1996-11-27 19:52:01 +00:00
Guido van Rossum 6244867e56 Revamped test case and updated doc string. 1996-09-17 21:33:15 +00:00
Guido van Rossum 44a4d59b56 support 'whence' arg to seek() 1996-01-25 18:40:41 +00:00
Jack Jansen 9715779810 Added class MHMailbox
Added optional third parameter to seek.
1995-10-23 13:59:53 +00:00
Guido van Rossum 2922c6dabb Changes to use default argument values where possible 1994-05-06 14:28:19 +00:00
Guido van Rossum c7b6882326 Jack's module for parsing UNIX mailbox files 1994-04-28 09:53:33 +00:00