summaryrefslogtreecommitdiffstats
path: root/Lib/email
Commit message (Collapse)AuthorAgeFilesLines
* Open the test files in binary mode so the \r\n files won't causeBarry Warsaw2002-09-182-3/+3
| | | | failures on Windows. Closes SF bug # 609988.
* Bump to 2.3.1 to pick up the missing file.Barry Warsaw2002-09-121-1/+1
|
* get_payload(): Document that calling it with no arguments returns aBarry Warsaw2002-09-111-2/+3
| | | | reference to the payload.
* test_utils_quote_unquote(): Test for unquote() properlyBarry Warsaw2002-09-111-0/+7
| | | | de-backslash-ifying.
* rfc822.unquote() doesn't properly de-backslash-ify in Python prior toBarry Warsaw2002-09-111-1/+12
| | | | | 2.3. This patch (adapted from Quinn Dunkan's SF patch #573204) fixes the problem and should get ported to rfc822.py.
* _parsebody(): Instead of raising a BoundaryError when no startBarry Warsaw2002-09-101-2/+5
| | | | | boundary could be found -- in a lax parser -- the entire body is assigned to the message payload.
* Import _isstring() from the compatibility layer.Barry Warsaw2002-09-101-2/+12
| | | | | | | | | | | _handle_text(): Use _isstring() for stringiness test. _handle_multipart(): Add a test before the ListType test, checking for stringiness of the payload. String payloads for multitypes means a message with broken MIME chrome was parsed by a lax parser. Instead of raising a BoundaryError in those cases, the entire body is assigned to the message payload (but since the content type is still multipart/*, the Generator needs to be updated too).
* _isstring(): Factor out "stringiness" test, e.g. for StringType orBarry Warsaw2002-09-102-2/+10
| | | | UnicodeType, which is different between Python 2.1 and 2.2.
* _ascii_split(): Don't lstrip continuation lines. Closes SF bug #601392.Barry Warsaw2002-09-101-1/+1
|
* test_splitting_first_line_only_is_long(): New test for SF bug #601392,Barry Warsaw2002-09-101-1/+38
| | | | broken wrapping of long ASCII headers.
* A sample message with broken MIME boundaries.Barry Warsaw2002-09-101-0/+15
|
* test_set_param(), test_del_param(): Test RFC 2231 encoding support byBarry Warsaw2002-09-061-1/+68
| | | | Oleg Broytmann in SF patch #600096. Whitespace normalized by Barry.
* _formatparam(), set_param(): RFC 2231 encoding support by OlegBarry Warsaw2002-09-061-3/+11
| | | | | | Broytmann in SF patch #600096. Specifically, the former function now encodes the triplets, while the latter adds optional charset and language arguments.
* test_mondo_message(): "binary" is not a legal content type, so withBarry Warsaw2002-09-061-2/+3
| | | | | the previous RFC 2045, $5.2 repair to get_content_type() this subpart's type will now be text/plain.
* test_replace_header(): New test for Message.replace_header().Barry Warsaw2002-09-061-0/+17
|
* replace_header(): New method given by Skip Montanaro in SF patchBarry Warsaw2002-09-061-1/+15
| | | | | #601959. Modified slightly by Barry (who added the KeyError in case the header is missing.
* _structure(): Use .get_content_type()Barry Warsaw2002-09-011-1/+1
|
* Whitespace normalization.Barry Warsaw2002-08-271-1/+1
|
* TypoBarry Warsaw2002-08-271-1/+1
|
* Whitespace normalization.Tim Peters2002-08-233-9/+9
|
* Bump version number to 2.3Barry Warsaw2002-08-201-1/+1
|
* Added tests for SF patch #597593, syntactically invalid Content-Type: headers.Barry Warsaw2002-08-201-2/+23
|
* get_content_type(), get_content_maintype(), get_content_subtype(): RFCBarry Warsaw2002-08-201-5/+5
| | | | | | | | | | | 2045, section 5.2 states that if the Content-Type: header is syntactically invalid, the default type should be text/plain. Implement minimal sanity checking of the header -- it must have exactly one slash in it. This closes SF patch #597593 by Skip, but in a different way. Note that these methods used to raise ValueError for invalid ctypes, but now they won't.
* _dispatch(): Use get_content_maintype() and get_content_subtype() toBarry Warsaw2002-08-201-3/+2
| | | | | | get the MIME main and sub types, instead of getting the whole ctype and splitting it here. The two more specific methods now correctly implement RFC 2045, section 5.2.
* test_three_lines(): Test case reported by Andrew McNamara. Works inBarry Warsaw2002-08-201-0/+8
| | | | email 2.2 but fails in email 1.0.
* Use full package paths in imports.Barry Warsaw2002-07-231-7/+2
|
* Added a couple of more tests for Header charset handling.Barry Warsaw2002-07-231-0/+15
|
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-232-3/+3
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* append(): Bite the bullet and let charset be the string name of aBarry Warsaw2002-07-231-3/+6
| | | | character set, which we'll convert to a Charset instance. Sigh.
* make_header(): Watch out for charset is None, which decode_header()Barry Warsaw2002-07-231-3/+2
| | | | will return as the charset if implicit us-ascii is used.
* Changed import fromTim Peters2002-07-211-1/+1
| | | | | | | | | | | | | | | | | | from test.test_support import TestSkipped, run_unittest to from test_support import TestSkipped, run_unittest Otherwise, if the Japanese codecs aren't installed, regrtest doesn't believe the TestSkipped exception raised by this test matches the except (ImportError, test_support.TestSkipped), msg: it's looking for, and reports the skip as a crash failure instead of as a skipped test. I suppose this will make it harder to run this test outside of regrtest, but under the assumption only Barry does that, better to make it skip cleanly for everyone else.
* The email package's tests live much better in a subpackageBarry Warsaw2002-07-194-0/+2290
| | | | | | | | | | | | (i.e. email.test), so move the guts of them here from Lib/test. The latter directory will retain stubs to run the email.test tests using Python's standard regression test. test_email_torture.py is a torture tester which will not run under Python's test suite because I don't want to commit megs of data to that project (it will fail cleanly there). When run under the mimelib project it'll stress test the package with megs of message samples collected from various locations in the wild.
* The email package's tests live much better in a subpackageBarry Warsaw2002-07-1931-0/+1182
| | | | | | | | | | | | | | | (i.e. email.test), so move the guts of them here from Lib/test. The latter directory will retain stubs to run the email.test tests using Python's standard regression test. test_email_torture.py is a torture tester which will not run under Python's test suite because I don't want to commit megs of data to that project (it will fail cleanly there). When run under the mimelib project it'll stress test the package with megs of message samples collected from various locations in the wild. email/test/data is a copy of Lib/test/data. The fate of the latter is still undecided.
* message_from_string(), message_from_file(): The consensus on theBarry Warsaw2002-07-191-2/+2
| | | | | mimelib-devel list is that non-strict parsing should be the default. Make it so.
* Parser.__init__(): The consensus on the mimelib-devel list is thatBarry Warsaw2002-07-191-2/+2
| | | | non-strict parsing should be the default. Make it so.
* To better support default content types, fix an API wart, and preserveBarry Warsaw2002-07-191-13/+62
| | | | | | | | | | | | | | | | backwards compatibility, we're silently deprecating get_type(), get_subtype() and get_main_type(). We may eventually noisily deprecate these. For now, we'll just fix a bug in the splitting of the main and subtypes. get_content_type(), get_content_maintype(), get_content_subtype(): New methods which replace the above. These /always/ return a content type string and do not take a failobj, because an email message always at least has a default content type. set_default_type(): Someday there may be additional default content types, so don't hard code an assertion about the value of the ctype argument.
* _structure(): Take an optional `fp' argument which would be the objectBarry Warsaw2002-07-191-3/+7
| | | | to print>> the structure to. Defaults to sys.stdout.
* _dispatch(): Use the new Message.get_content_type() method as hashedBarry Warsaw2002-07-191-6/+1
| | | | out on the mimelib-devel list.
* Anthony Baxter's cleanup patch. Python project SF patch # 583190,Barry Warsaw2002-07-182-22/+29
| | | | | | | | | | | | | | | | | | | | | | | | quoting: in non-strict mode, messages don't require a blank line at the end with a missing end-terminator. A single newline is sufficient now. Handle trailing whitespace at the end of a boundary. Had to switch from using string.split() to re.split() Handle whitespace on the end of a parameter list for Content-type. Handle whitespace on the end of a plain content-type header. Specifically, get_type(): Strip the content type string. _get_params_preserve(): Strip the parameter names and values on both sides. _parsebody(): Lots of changes as described above, with some stylistic changes by Barry (who hopefully didn't screw things up ;).
* Anthony Baxter's patch to expose the parser's `strict' flag in theseBarry Warsaw2002-07-181-5/+5
| | | | convenience functions. Closes SF # 583188 (python project).
* _structure(): Don't get the whole Content-Type: header, just get theBarry Warsaw2002-07-111-1/+1
| | | | type with get_type().
* _dispatch(): Comment improvements.Barry Warsaw2002-07-111-3/+3
|
* make_header(): New function to take the output of decode_header() andBarry Warsaw2002-07-091-6/+45
| | | | | | | | | | | create a Header instance. Closes feature request #539481. Header.__init__(): Allow the initial string to be omitted. __eq__(), __ne__(): Support rich comparisons for equality of Header instances withy Header instances or strings. Also, update a bunch of docstrings.
* Anthony Baxter's patch for non-strict parsing. This adds a `strict'Barry Warsaw2002-07-091-24/+71
| | | | | | | | | | | | | | | | | argument to the constructor -- defaulting to true -- which is different than Anthony's approach of using global state. parse(), parsestr(): Grow a `headersonly' argument which stops parsing once the header block has been seen, i.e. it does /not/ parse or even read the body of the message. This is used for parsing message/rfc822 type messages. We need test cases for the non-strict parsing. Anthony will supply these. _parsebody(): We can get rid of the isdigest end-of-line kludges, although we still need to know if we're parsing a multipart/digest so we can set the default type accordingly.
* Add the concept of a "default type". Normally the default type isBarry Warsaw2002-07-091-0/+22
| | | | | | | | | | text/plain but the RFCs state that inside a multipart/digest, the default type is message/rfc822. To preserve idempotency, we need a separate place to define the default type than the Content-Type: header. get_default_type(), set_default_type(): Accessor and mutator methods for the default type.
* __init__(): Don't attach the subparts if its an empty tuple. If theBarry Warsaw2002-07-091-2/+5
| | | | boundary was given in the arguments, call set_boundary().
* clone(): A new method for creating a clone of this generator (forBarry Warsaw2002-07-091-27/+24
| | | | | | | | | | | | | recursive generation). _dispatch(): If the message object doesn't have a Content-Type: header, check its default type instead of assuming it's text/plain. This makes for correct generation of message/rfc822 containers. _handle_multipart(): We can get rid of the isdigest kludge. Just print the message as normal and everything will work out correctly. _handle_mulitpart_digest(): We don't need this anymore either.
* __init__(): Be sure to set the default type to message/rfc822.Barry Warsaw2002-07-091-0/+2
|
* _structure(): A handy little debugging aid that I don't (yet) intendBarry Warsaw2002-07-091-0/+10
| | | | to make public, but that others might still find useful.
* With the addition of Oleg's support for RFC 2231, it's time to bumpBarry Warsaw2002-07-091-1/+1
| | | | the version number to 2.1.