summaryrefslogtreecommitdiffstats
path: root/Lib/email/Message.py
Commit message (Collapse)AuthorAgeFilesLines
* as_string(): Added some text to the docstring to make it clear thatBarry Warsaw2003-04-181-0/+4
| | | | | it's a convenience only and give hints on what to do for more flexibility.
* get_payload(): Teach this about various uunencodedBarry Warsaw2003-03-111-10/+21
| | | | Content-Transfer-Encodings
* get_payload(): If we get a low-level binascii.Error when base64Barry Warsaw2003-03-101-5/+12
| | | | decoding the payload, just return it as-is.
* get_content_charset(): RFC 2046 $4.1.2 says charsets are not caseBarry Warsaw2002-10-101-4/+6
| | | | sensitive. Coerce the argument to lower case.
* __contains__(): Change the second argument to `name' for consistency.Barry Warsaw2002-09-301-58/+69
| | | | | | I seriously doubt this will break any deployed code. Docstring consistency with the updated .tex files.
* is_multipart(): Use isinstance() instead of type equality.Barry Warsaw2002-09-281-1/+1
|
* Docstring and code cleanups, e.g. use True/False everywhere.Barry Warsaw2002-09-281-58/+62
|
* Fixing some RFC 2231 related issues as reported in the SpambayesBarry Warsaw2002-09-261-9/+39
| | | | | | | | | | | | | | | | | | | | | project, and with assistance from Oleg Broytmann. Specifically, get_param(), get_params(): Document that these methods may return parameter values that are either strings, or 3-tuples in the case of RFC 2231 encoded parameters. The application should be prepared to deal with such return values. get_boundary(): Be prepared to deal with RFC 2231 encoded boundary parameters. It makes little sense to have boundaries that are anything but ascii, so if we get back a 3-tuple from get_param() we will decode it into ascii and let any failures percolate up. get_content_charset(): New method which treats the charset parameter just like the boundary parameter in get_boundary(). Note that "get_charset()" was already taken to return the default Charset object. get_charsets(): Rewrite to use get_content_charset().
* get_payload(): Document that calling it with no arguments returns aBarry Warsaw2002-09-111-2/+3
| | | | reference to the payload.
* _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.
* 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.
* TypoBarry Warsaw2002-08-271-1/+1
|
* Whitespace normalization.Tim Peters2002-08-231-3/+3
|
* 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.
* 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.
* Anthony Baxter's cleanup patch. Python project SF patch # 583190,Barry Warsaw2002-07-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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 ;).
* 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.
* 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.
* Use absolute import paths for intrapackage imports.Barry Warsaw2002-06-021-5/+5
| | | | as_string(): Use Generator.flatten() for better performance.
* Whitespace normalization.Tim Peters2002-05-231-1/+1
|
* Complete a merge of the mimelib project and the Python cvs codebasesBarry Warsaw2002-05-191-11/+5
| | | | | | | | | | | | | for the email package. The former is now just a shell project that has some extra files for packaging for independent use (e.g. setup.py and README). Added a compatibility layer so that the same API can be used in Python 2.1 and 2.2/2.3 with the major differences shuffled off into helper modules (_compat21.py and _compat22.py). Also bumped the package version number to 2.0.3 for some fixes to be checked in momentarily.
* Sync'ing with standalone email package 2.0.1. This adds support forBarry Warsaw2002-04-101-18/+205
| | | | | | | | | non-us-ascii character sets in headers and bodies. Some API changes (with DeprecationWarnings for the old APIs). Better RFC-compliant implementations of base64 and quoted-printable. Updated test cases. Documentation updates to follow (after I finish writing them ;).
* More typo fixes.Barry Warsaw2001-11-241-2/+2
|
* Docstring typo fix.Greg Ward2001-11-241-1/+1
|
* walk(): Fix docstring; traversal is depth-first. Closes mimelib bugBarry Warsaw2001-11-051-1/+1
| | | | #477864.
* A fix for SF bug #472560, extra newlines returned by get_param() whenBarry Warsaw2001-10-251-1/+1
| | | | | | | | the separating semi-colon shows up on a continuation line (legal, but weird). Bug reported and fixed by Matthew Cowles. Test case and sample email included.
* get_all(): We never returned failobj if we found no matching headers.Barry Warsaw2001-10-091-0/+4
| | | | Fix that, and also make the docstring describe failobj.
* Give me back my page breaks.Barry Warsaw2001-10-041-1/+1
|
* Whitespace normalization.Tim Peters2001-10-041-2/+2
|
* has_key(): Implement in terms of get().Barry Warsaw2001-09-261-33/+58
| | | | | | | | | | | | | | | get_type(): Use a compiled regular expression, which can be shared. _get_params_preserve(): A helper method which extracts the header's parameter list preserving value quoting. I'm not sure that this needs to be a public method. It's necessary because we want get_param() and friends to return the unquoted parameter value, however we want the quote-preserved form for set_boundary(). get_params(), get_param(), set_boundary(): Implement in terms of _get_params_preserve(). walk(): Yield ourself first, then recurse over our subparts (if any).
* The email package version 1.0, prototyped as mimelibBarry Warsaw2001-09-231-0/+422
<http://sf.net/projects/mimelib>. There /are/ API differences between mimelib and email, but most of the implementations are shared (except where cool Py2.2 stuff like generators are used).