summaryrefslogtreecommitdiffstats
path: root/Lib/email
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* append(): Clarify the expected type of charset.Barry Warsaw2002-07-031-1/+2
|
* Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133Barry Warsaw2002-06-291-0/+57
| | | | | | | | | Specifically, decode_rfc2231(), encode_rfc2231(): Functions to encode and decode RFC 2231 style parameters. decode_params(): Function to decode a list of parameters.
* Oleg Broytmann's support for RFC 2231 encoded parameters, SF patch #549133Barry Warsaw2002-06-291-7/+27
| | | | | | | | | | | | | | | | | Specifically, _formatparam(): Teach this about encoded `param' arguments, which are a 3-tuple of items (charset, language, value). language is ignored. _unquotevalue(): Handle both 3-tuple RFC 2231 values and unencoded values. _get_params_preserve(): Decode the parameters before returning them. get_params(), get_param(): Use _unquotevalue(). get_filename(), get_boundary(): Teach these about encoded (3-tuple) parameters.
* __unicode__(): Patch # 541263 by Mikhail Zabaluev, implementationBarry Warsaw2002-06-291-0/+6
| | | | modified by Barry.
* _max_append(): When adding the string `s' to its own line, it shouldBarry Warsaw2002-06-281-2/+2
| | | | | be lstrip'd so that old continuation whitespace is replaced by that specified in Header's continuation_ws parameter.
* Teach this class about "highest-level syntactic breaks" but only forBarry Warsaw2002-06-281-58/+151
| | | | | | | | | | | | | | | | | | | | | | | headers with no charset or 'us-ascii' charsets. Actually this is only partially true: we know about semicolons (but not true parameters) and we know about whitespace (but not technically folding whitespace). Still it should be good enough for all practical purposes. Other changes include: __init__(): Add a continuation_ws argument, which defaults to a single space. Set this to change the whitespace used for continuation lines when a header must be split. Also, changed the way header line lengths are calculated, so that they take into account continuation_ws (when tabs-expanded) and any provided header_name parameter. This should do much better on returning split headers for which the first and subsequent lines must fit into a specified width. guess_maxlinelen(): Removed. I don't think we need this method as part of the public API. encode_chunks() -> _encode_chunks(): I don't think we need this one as part of the public API either.
* _split_header(): The code here was terminally broken because it didn'tBarry Warsaw2002-06-281-53/+11
| | | | | | | | know anything about RFC 2047 encoded headers. Fortunately we have a perfectly good header splitter in Header.encode(). So we just call that to give us a properly formatted and split header. Header.encode() didn't know about "highest-level syntactic breaks" but that's been fixed now too.
* _parsebody(): Fix for the new message/rfc822 tree structure (theBarry Warsaw2002-06-021-4/+3
| | | | parent is now a multipart with one element, the sub-message object).
* header_encode(), encode(): Use _floordiv() from the appropriateBarry Warsaw2002-06-021-2/+9
| | | | compatibility module.
* Use absolute import paths for intrapackage imports.Barry Warsaw2002-06-021-2/+2
|
* Use absolute import paths for intrapackage imports.Barry Warsaw2002-06-021-5/+5
| | | | as_string(): Use Generator.flatten() for better performance.
* Use absolute import paths for intrapackage imports.Barry Warsaw2002-06-025-22/+23
| | | | | Use MIMENonMultipart as the base class so that you can't attach() to these non-multipart message types.
* flatten(): Renamed from __call__() which is (silently) deprecated.Barry Warsaw2002-06-021-7/+11
| | | | | | | | | __call__() can be 2-3x slower than the equivalent normal method. _handle_message(): The structure of message/rfc822 message has changed. Now parent's payload is a list of length 1, and the zeroth element is the Message sub-object. Adjust the printing of such message trees to reflect this change.
* _intdiv2() -> _floordiv(), merge of uncommitted changes.Barry Warsaw2002-06-022-8/+8
|
* Get email test to pass. Barry, hope this is what you had in mindNeal Norwitz2002-06-022-6/+6
|
* Bump to version 2.0.5, and also use absolute import paths.Barry Warsaw2002-06-011-3/+3
|
* These two classes provide bases for more specific content typeBarry Warsaw2002-06-012-0/+54
| | | | | | | | | | | | | subclasses. MIMENonMultipart: Base class for non-multipart/* content type subclass specializations, e.g. image/gif. This class overrides attach() which raises an exception, since it makes no sense to attach a subpart to e.g. an image/gif message. MIMEMultipart: Base class for multipart/* content type subclass specializations, e.g. multipart/mixed. Does little more than provide a useful constructor.
* The _compat modules now export _floordiv() instead of _intdiv2() forBarry Warsaw2002-06-011-5/+4
| | | | | | better code reuse. _split() Use _floordiv().
* Slightly better docstringBarry Warsaw2002-06-011-1/+1
|
* _is_unicode(): Use UnicodeType instead of the unicode builtin forBarry Warsaw2002-06-011-1/+3
| | | | Python 2.1 compatibility.
* Use floor division where appropriate.Guido van Rossum2002-05-291-2/+2
|
* Importing Charset should not fail when Unicode is disabled. (XXXGuido van Rossum2002-05-281-3/+11
| | | | | Using Unicode-aware methods may still die with a NameError on unicode. Maybe there's a more elegant solution but I doubt anybody cares.)
* Whitespace normalization.Tim Peters2002-05-236-27/+27
|
* Bump to version 2.0.4Barry Warsaw2002-05-221-1/+1
|
* getaddresses(): Like the change in rfc822.py, this one needs to accessBarry Warsaw2002-05-221-1/+1
| | | | | | the AddressList.addresslist attribute directly. Also, add a test case for the email.Utils.getaddresses() interface.