Commit Graph

50 Commits

Author SHA1 Message Date
Guido van Rossum a66eed62fd Implement the suggestion of bug_id=122070: surround tell() call with
try/except.
2000-11-09 18:05:24 +00:00
Barry Warsaw 2ea2b1133e AddrlistClass.getdomainliteral(): rfc822 requires that the domain
literal be wrapped in square brackets.  This fix replaces the square
brackets that were previously being stripped off.  Closes SF bug
#110621.
2000-09-25 15:08:27 +00:00
Thomas Wouters 104a7bcc28 Support for augmented assignment in the UserList, UserDict, UserString and
rfc822 (Addresslist) modules. Also a preliminary testcase for augmented
assignment, which should actually be merged with the test_class testcase I
added last week.
2000-08-24 20:14:10 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Fred Drake 13a2c279c5 Untabify to pass the -tt test. 2000-02-10 17:17:14 +00:00
Guido van Rossum 1d2b23ef22 Fix by Nick Russo in processing of timezone in test program; the
ParsedDate didn't have the correct day of week.
2000-01-17 14:11:04 +00:00
Guido van Rossum d8957d6802 Fix PR#3, submitted by Skip Montanaro: if no space appears after the
colon, the first character of the value is lost.
1999-10-06 15:19:19 +00:00
Guido van Rossum f3c5f5c044 After much hemming and hawing, we decided to roll back Fred's change.
It breaks Mailman, it was actually documented in the docstring, so it
was an intentional deviation from the usual del semantics.  Let's
document the original behavior in Doc/lib/librfc822.tex.
1999-09-15 22:15:23 +00:00
Fred Drake 81ffe75d1c Message.__delitem__(): If the key doesn't exist in the dictionary,
raise KeyError instead of failing silently!
1999-09-10 20:54:53 +00:00
Guido van Rossum a07934e53f Correct typo in AddressList.__getitem__. By Moshe Zadka. 1999-09-03 13:23:49 +00:00
Barry Warsaw 96e9bf45e8 AddrlistClass.getaddress(): when parsing `:'s, in the loop, watch out
for gotonext() pushing self.pos past the end of the string.  This can
happen if the message has a To field like "To: :" and you call
msg.getaddrlist('to').
1999-07-12 18:37:02 +00:00
Guido van Rossum b184487055 Barry Scott writes:
Problem: rfc822.py in 1.5.2 final loses the quotes around
quoted local-part names.

The fix is to preserve the quotes around a local-part
name in an address.

Test:

	import rfc822
	a = rfc822.AddrlistClass('(Comment stuff) "Quoted
name"@somewhere.com')
	a.getaddrlist()

The correct result is:

	[('Comment stuff', '"Quoted name"@somewhere.com')]
1999-06-15 18:06:20 +00:00
Fred Drake cbfa5cbcc8 Message.getheaders(): If there are no matching headers, return an
empty list instead of None.  (Guido's request.)
1999-06-14 15:40:23 +00:00
Guido van Rossum b08f51b93a Mike Meyer reports a bug in his patch (several months ago) that
accepts long month names.  One essential line was missing.  Fixed now.
1999-04-29 12:50:36 +00:00
Fred Drake ddf22c4243 Message.getheader(): Fixed grammatical error in docstring.
Message.getheaders():  Method to get list of all values for each
		       instance of a named header.  See docstring for more.
1999-04-28 21:17:38 +00:00
Guido van Rossum 247a78a10d Utility function that yields a properly formatted time string.
(Idea by Jeff Bauer, code by Jeremy, renamed and "Date:" constant
stripped from return value by GvR.)
1999-04-19 18:04:38 +00:00
Barry Warsaw 8a578436f4 Message.getaddrlist(): This now handles multiple occurances of the
named header, so that if a message has, e.g. multiple CC: lines, all
will get returned by the call to getaddrlist().  It also correctly
handles addresses which show up in continuation lines.

AdderlistClass.__init__(): Added \n to self.CR which fixes a bug that
sometimes, an address would contain a bogus trailing newline.

Message.getaddress(): In final else clause, added a test for the
character we're at being in self.specials.  Without this, such
characters never get consumed and we infloop.  Case in point (as
posted to c.l.py):

To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com>
----------------------------^
otherwise we'd infloop here
1999-01-14 19:59:58 +00:00
Guido van Rossum db01ee0e22 Patch by Mike Meyer:
Extended the rfc822 parsedate routines to handle the cases they failed
on in an archive of ~37,000 messages.  I believe the changes are
compatible, in that all previously correct parsing are still correct.

[I still see problems with some messages, but no showstoppers.]
1998-12-23 22:22:10 +00:00
Guido van Rossum 99e1131536 Avoid crash in parsedate_tz() on certain invalid dates -- when the
field assumed to be the time is in fact the year, the resulting list
doesn't have enough items, and this isn't checked for.  Return None
instead.
1998-12-23 21:58:38 +00:00
Guido van Rossum 052969a602 Don't use calculations on values gotten from tell(). Also use a
slightly different way to test for the existence of unread.
1998-07-21 14:24:04 +00:00
Guido van Rossum 5430b432e6 Bugfix to ESR's code reported by himself: should use hasattr() to test
for presence unread, not getattr()!
1998-06-22 15:46:26 +00:00
Guido van Rossum 81d10b479e Add __getitem__ to AddressList object, to make it a sequence. 1998-06-16 22:29:03 +00:00
Guido van Rossum 4d4ab9245f Some extra comments and docstrings, and a new class (AddressList), all by ESR. 1998-06-16 22:27:09 +00:00
Guido van Rossum e894fc0ea3 Support new overridable method, isheader() (ESR).
Also implement __setitem__(), more-or-less correctly (GvR).
1998-06-11 13:58:40 +00:00
Guido van Rossum c7bb8577c7 Some changes suggested/provided by Eric Raymond:
- explain seekable
- when seekable==1, test fp.tell() and set it to 0 if that fails
- support overridable method iscomment(line) to weed out comments
- check for unread() method on file object before trying to seek

And one of my own:

- Add a get() method which behaves like a dictionary's get(); this is
actually implemented by giving getheader() an optional second argument
to specify the default, and aliasing get to getheader.
1998-06-10 21:31:01 +00:00
Guido van Rossum 67133e25a2 Neatify the _timezones table and remove a misleading comment about
inaccuracies in mktime_tz().
1998-05-18 16:09:10 +00:00
Guido van Rossum 75d92c1864 Added a __delitem__ to the Message class.
(Still no __setitem__, until I get a request to add it!)
1998-04-02 21:33:20 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum 9e43adbe78 Initialize adlist variable in getrouteaddr(), so an illegal address
doesn't cause a traceback.
1998-03-03 16:17:52 +00:00
Guido van Rossum a73033fcc2 Feature added by Bill van Melle: when no timezone is present, assume
local time -- that's better than failure.
1998-02-19 00:28:58 +00:00
Guido van Rossum 00455b77a6 Fix sign reversal in mktime_tz discovered by Bill van Melle. 1998-02-18 05:06:30 +00:00
Guido van Rossum 9e326665cf Remove unneeded "import re". 1997-12-11 21:41:13 +00:00
Guido van Rossum 9ab94c18d8 Doc strings and reformatting with 4 spaces bty Mitch Chapman.
Untabified and minor tweaks by me.
1997-12-10 16:17:39 +00:00
Guido van Rossum be7c45eec4 New address parser by Ben Escoto replaces
Sjoerd Mullender's parseaddr()
1997-11-22 21:49:19 +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 7883e1dfbd Entirely rewritten parseaddr() function by Sjoerd Mullender.
(Includes a patch he sent me a few days later.)
1997-09-15 14:12:54 +00:00
Guido van Rossum 9a876a4500 Tweaks by Lars Wirzenius to parse some more forms of illegal dates:
the comma after the day name is optional if it is a recognized day
name; and the date and month may be swapped.  Thus, the following two
test dates will now be parsed correctly:
	Thu, Feb 13 12:16:57 1992
	Thu Feb 13 12:16:57 1992
1997-07-25 15:20:52 +00:00
Guido van Rossum c17a268398 Added support for RFC 850 style dates, as used by some HTTP servers
(such as Netscape-Commerce and CERN).

An example of a RFC 850 date: 'Wednesday, 18-Dec-96 21:00:00 GMT'

From: Chris Lawrence <quango@themall.net>
1996-12-27 15:42:35 +00:00
Guido van Rossum 6cdd7a0433 Add mktime_tz() which turns a date_tz 10-tuple into a standard Unix timestamp. 1996-12-12 18:39:54 +00:00
Guido van Rossum 27cb8a4884 Added support for timezone in date field. getdate_tz() and
parsedate_tz() return a 10-tuple, the last field is the tz offset in
seconds (e.g. -18000 or -5 hours for EST).
1996-11-20 22:12:26 +00:00
Guido van Rossum 3534a8932a New, improved parseaddr() by Sjoerd. 1996-07-30 16:29:16 +00:00
Guido van Rossum a13edb489b optimization of getheader() using a dictionary 1996-05-28 23:08:25 +00:00
Guido van Rossum 92457b9f8d added seekable option; save unix from lines; speed up islast() 1995-06-22 19:06:57 +00:00
Jack Jansen e5e2cdde15 Removed >From stuff 1995-06-16 10:57:14 +00:00
Jack Jansen 3a15dca1a0 Skip old-style 'From name time' lines at beginning of message. 1995-06-13 11:19:48 +00:00
Guido van Rossum 853474194f mhlib.py: delay opening of sequences file so we don't overwrite it when
putsequences is called with a bad argument
rfc822.py: better handling of dates with no or bad timezones
uu.py: contributed by Lance -- uu{en,de}code
1994-09-09 11:10:15 +00:00
Guido van Rossum 3f9a6ec9e6 * Lib/rfc822.py: fix two bugs: error in readheaders interpreting
regex.match() result, and wrong logic in getfirstmatchingheader()
	when the same header occurs twice consecutively
1994-08-12 13:16:50 +00:00
Guido van Rossum b6775db241 Merge alpha100 branch back to main trunk 1994-08-01 11:34:53 +00:00
Guido van Rossum 7bc817d5ba * Mass change: get rid of all init() methods, in favor of __init__()
constructors.  There is no backward compatibility.  Not everything has
  been tested.
* aiff.{py,doc}: deleted in favor of aifc.py (which contains its docs as
  comments)
1993-12-17 15:25:27 +00:00
Guido van Rossum 01ca336ed1 New modules mimetools and rfc822.
Minor, minor changes to commands.py and sndhdr.py.
1992-07-13 14:28:59 +00:00