summaryrefslogtreecommitdiffstats
path: root/Lib/rfc822.py
Commit message (Collapse)AuthorAgeFilesLines
* Bug #1030125: rfc822 __iter__ problemRaymond Hettinger2004-09-221-0/+3
| | | | Add iteration support to the Message class.
* Resolution of bug #997368, "strftime() backward compatibility".Barry Warsaw2004-08-071-1/+1
| | | | | | | | | Specifically, time.strftime() no longer accepts a 0 in the yday position of a time tuple, since that can crash some platform strftime() implementations. parsedate_tz(): Change the return value to return 1 in the yday position. Update tests in test_rfc822.py and test_email.py
* Make Message.__str__ more efficient.Neil Schemenauer2003-11-111-4/+1
|
* Implement and apply PEP 322, reverse iterationRaymond Hettinger2003-11-061-2/+1
|
* unquote(): Didn't properly de-backslash-ify. This patch (adapted fromBarry Warsaw2002-09-111-3/+3
| | | | Quinn Dunkan's mimelib SF patch #573204) fixes the problem.
* Whitespace normalization.Tim Peters2002-07-161-1/+1
|
* SF bug 558179.Guido van Rossum2002-06-051-7/+0
| | | | | Change default for get() back to None. Will backport to 2.2.1.
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-7/+11
|
* parseaddr(): Fixed in the same way that Message.getaddrlist() wasBarry Warsaw2002-05-231-1/+1
| | | | fixed (re: SF bug #555035). Include a unittest.
* Message.getaddrlist(): Use the AddressList.addresslist attributeBarry Warsaw2002-05-211-1/+1
| | | | | | | | instead of calling the getaddrlist() method, since the latter doesn't work with multiple calls (it will return the empty list for the second and subsequent calls). Closes SF bug #555035. Include a unittest.
* AddrlistClass -> AddressListBarry Warsaw2002-04-121-2/+2
|
* Partial introduction of bools where appropriate.Guido van Rossum2002-04-071-1/+1
|
* SF patch #495358 (Artur Zaprzala): rfc822.AddressList and "<>" addressGuido van Rossum2001-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | rfc822.AddressList incorrectly handles empty address. "<>" is converted to None and should be "". AddressList.__str__() fails on None. I got an email with such an address and my program failed processing it. Example: >>> import rfc822 >>> rfc822.AddressList("<>").addresslist [('', None)] >>> str(rfc822.AddressList("<>")) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.1/rfc822.py", line 753, in __str__ return ", ".join(map(dump_address_pair, self.addresslist)) TypeError: sequence item 0: expected string, None found [His solution: in the internal routine AddrlistClass.getrouteaddr(), initialize adlist to "".]
* Fix for bug #481221, getaddrlist() failing on long addresses.Barry Warsaw2001-11-131-4/+8
|
* parsedate_tz(): If data is false, return None. Fixes bug #478115,Barry Warsaw2001-11-131-0/+2
| | | | IndexError when a Date: field exists with an empty value.
* The first batch of changes recommended by the fixdiv tool. These areGuido van Rossum2001-09-041-1/+1
| | | | | mostly changes of / operators into //. Once or twice I did more or less than recommended.
* Whitespace normalization.Tim Peters2001-09-041-1/+1
|
* Add content-type header to ftp URLs (SF patch #454553)Jeremy Hylton2001-08-271-2/+12
| | | | | | | | Modify rfc822.formatdate() to always generate English names, regardless of locale. This is required by RFC 1123. In open_local_file() of urllib and urllib2, use new formatdate() from rfc822.
* Remove unused variable (PyChecker)Andrew M. Kuchling2001-08-131-1/+0
|
* Stoopid change, just to mention that the last checkin resolves SF bugBarry Warsaw2001-07-161-1/+1
| | | | #437395
* Fix address parsing to be RFC 2822 conformant. Specifically, dots areBarry Warsaw2001-07-161-105/+123
| | | | | | | | | | | | | | | | | | | | | | | | now allowed in unquoted RealName areas (technically, they are defined as "obsolete syntax" we MUST accept in phrases, as part of the obs-phrase production). Thus, parsing To: User J. Person <person@dom.ain> correctly returns "User J. Person" as the RealName. AddrlistClass.__init__(): Add definition of self.phraseends which is just self.atomends with `.' removed. getatom(): Add an optional argument `atomends' which, if None (the default) means use self.atomends. getphraselist(): Pass self.phraseends to getatom() and break out of the loop only when the current character is in phraseends instead of atomends. This allows dots to continue to serve as atom delimiters in all contexts except phrases. Also, loads of docstring updates to document RFC 2822 conformance (sorry, this should have been two separate patches).
* Clean up a bare except: clause.unknown2001-07-041-1/+1
|
* Per discussion with Barry, make the default value for both get() andFred Drake2001-05-221-5/+4
| | | | | | setdefault() the empty string. In setdefault(), use + to join the value to create the entry for the headers attribute so that TypeError is raised if the value is of the wrong type.
* Added .get() and .setdefault() support to rfc822.Message.Fred Drake2001-05-221-0/+20
|
* bunch more __all__ listsSkip Montanaro2001-02-151-0/+1
| | | | | | also modified check_all function to suppress all warnings since they aren't relevant to what this test is doing (allows quiet checking of regsub, for instance)
* Whitespace normalization.Tim Peters2001-01-151-83/+83
|
* Duh. Instead of string.whitespace and string.digits, use isspace()Guido van Rossum2001-01-021-6/+5
| | | | and isdigit() methods.
* Get rid of string functions. References to string.whitespace,Guido van Rossum2000-12-151-63/+57
| | | | string.digits are left.
* Implement the suggestion of bug_id=122070: surround tell() call withGuido van Rossum2000-11-091-1/+5
| | | | try/except.
* AddrlistClass.getdomainliteral(): rfc822 requires that the domainBarry Warsaw2000-09-251-1/+1
| | | | | | literal be wrapped in square brackets. This fix replaces the square brackets that were previously being stripped off. Closes SF bug #110621.
* Support for augmented assignment in the UserList, UserDict, UserString andThomas Wouters2000-08-241-0/+14
| | | | | | rfc822 (Addresslist) modules. Also a preliminary testcase for augmented assignment, which should actually be merged with the test_class testcase I added last week.
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-1/+1
| | | | | | | | | | 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 ;)
* Untabify to pass the -tt test.Fred Drake2000-02-101-11/+11
|
* Fix by Nick Russo in processing of timezone in test program; theGuido van Rossum2000-01-171-2/+4
| | | | ParsedDate didn't have the correct day of week.
* Fix PR#3, submitted by Skip Montanaro: if no space appears after theGuido van Rossum1999-10-061-1/+1
| | | | colon, the first character of the value is lost.
* After much hemming and hawing, we decided to roll back Fred's change.Guido van Rossum1999-09-151-5/+5
| | | | | | 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.
* Message.__delitem__(): If the key doesn't exist in the dictionary,Fred Drake1999-09-101-5/+5
| | | | raise KeyError instead of failing silently!
* Correct typo in AddressList.__getitem__. By Moshe Zadka.Guido van Rossum1999-09-031-1/+1
|
* AddrlistClass.getaddress(): when parsing `:'s, in the loop, watch outBarry Warsaw1999-07-121-1/+2
| | | | | | 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').
* Barry Scott writes:Guido van Rossum1999-06-151-1/+1
| | | | | | | | | | | | | | | | | | | 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')]
* Message.getheaders(): If there are no matching headers, return anFred Drake1999-06-141-2/+3
| | | | empty list instead of None. (Guido's request.)
* Mike Meyer reports a bug in his patch (several months ago) thatGuido van Rossum1999-04-291-0/+1
| | | | accepts long month names. One essential line was missing. Fixed now.
* Message.getheader(): Fixed grammatical error in docstring.Fred Drake1999-04-281-1/+26
| | | | | Message.getheaders(): Method to get list of all values for each instance of a named header. See docstring for more.
* Utility function that yields a properly formatted time string.Guido van Rossum1999-04-191-0/+10
| | | | | (Idea by Jeff Bauer, code by Jeremy, renamed and "Date:" constant stripped from return value by GvR.)
* Message.getaddrlist(): This now handles multiple occurances of theBarry Warsaw1999-01-141-12/+21
| | | | | | | | | | | | | | | | | | 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
* Patch by Mike Meyer:Guido van Rossum1998-12-231-5/+19
| | | | | | | | 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.]
* Avoid crash in parsedate_tz() on certain invalid dates -- when theGuido van Rossum1998-12-231-1/+3
| | | | | | 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.
* Don't use calculations on values gotten from tell(). Also use aGuido van Rossum1998-07-211-4/+11
| | | | slightly different way to test for the existence of unread.
* Bugfix to ESR's code reported by himself: should use hasattr() to testGuido van Rossum1998-06-221-1/+1
| | | | for presence unread, not getattr()!
* Add __getitem__ to AddressList object, to make it a sequence.Guido van Rossum1998-06-161-0/+4
|