summaryrefslogtreecommitdiffstats
path: root/Lib/email
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* I've thought about it some more, and I believe it is proper for theBarry Warsaw2002-05-191-10/+20
| | | | | | | | | | | | email package's Parser to handle the three common line endings. Certain protocols such as IMAP define CRLF line endings and it doesn't make sense for the client app to have to normalize the line endings before handing it message off to the Parser. _parsebody(): Be more flexible in the matching of line endings for finding the MIME separators. Accept any of \r, \n and \r\n. Note that we do /not/ change the line endings in the payloads, we just accept any of those three around MIME boundaries.
* Fixed a bug in the splitting of lines, and improved the splitting forBarry Warsaw2002-05-191-11/+29
| | | | | | | | | | | | | | | | | single byte character sets. Also fixed a semantic problem with the constructor's default arguments. Specifically, __init__(): Change the maxlinelen argument default to None instead of MAXLINELEN. The semantics should have been (and now are) that if maxlinelen is given it is always honored. If it isn't given, but header_name is given, then the maximum line length is calculated. If neither are given then the default 76 characters is used. _split(): If the character set is a single byte character set then we can split the line at the maxlinelen because we know that encoding the header won't increase its length. If the charset isn't a single byte charset then we use the quicker divide-and-conquer line splitting algorithm as before.
* Complete a merge of the mimelib project and the Python cvs codebasesBarry Warsaw2002-05-197-45/+168
| | | | | | | | | | | | | 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.
* parseaddr(): Don't use rfc822.parseaddr() because this now implies aBarry Warsaw2002-04-151-4/+3
| | | | | | | | double call to AddressList.getaddrlist(), and /that/ always returns an empty list for the second and subsequent calls. Instead, instantiate an AddressList directly, and get the parsed addresses out of the addresslist attribute.
* AddrlistClass -> AddressListBarry Warsaw2002-04-121-2/+2
|
* Sync'ing with standalone email package 2.0.1. This adds support forBarry Warsaw2002-04-1016-96/+1438
| | | | | | | | | 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 ;).
* Removed two unused imports. Closes patch #525225.Barry Warsaw2002-03-031-4/+0
| | | | 2.2.1 candidate (but not terribly important).
* _parsebody(): When adding subparts to a multipart container, make sureBarry Warsaw2002-01-271-2/+7
| | | | | | that the first subpart added makes the payload a list object. Otherwise, a multipart/* with only one subpart will not have the proper structure.
* decode(), encode(): Accepting the minor optimizations from SF patchBarry Warsaw2001-12-031-6/+7
| | | | | #486375, but not the rest of it, since that changes the documented semantics of encode().
* More typo fixes.Barry Warsaw2001-11-241-2/+2
|
* Docstring typo fix.Greg Ward2001-11-242-2/+2
|
* formatdate(): Jason Mastaler correctly points out that divmod with aBarry Warsaw2001-11-191-2/+8
| | | | | | negative modulus won't return the right values. So always do positive modulus on an absolute value and twiddle the sign as appropriate after the fact.
* formatdate(): The calculation of the minutes part of the zone wasBarry Warsaw2001-11-191-1/+2
| | | | | | | | incorrect for "uneven" timezones. This algorithm should work for even timezones (e.g. America/New_York) and uneven timezones (e.g. Australia/Adelaide and America/St_Johns). Closes SF bug #483231.
* Forgot to import time.Barry Warsaw2001-11-091-0/+1
|
* formatdate(): A better docstring.Barry Warsaw2001-11-091-4/+7
|
* formatdate(): An implementation to replace the one borrowed fromBarry Warsaw2001-11-091-1/+37
| | | | | | | | | | rfc822.py. The old rfc822.formatdate() produced date strings using obsolete syntax. The new version produces the preferred RFC 2822 dates. Also, an optional argument `localtime' is added, which if true, produces a date relative to the local timezone, with daylight savings time properly taken into account.
* 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.
* Another merge from mimelib:Barry Warsaw2001-10-191-0/+2
| | | | | | _handle_multipart(): If there is an epilogue and the epilogue does not itself start with a newline, add a newline before writing the epilogue. Closes SF bug #472481.
* Two merges from the mimelib project:Barry Warsaw2001-10-171-4/+35
| | | | | | | | _split_header(): Split on folding whitespace if the attempt to split on semi-colons failed. _split_header(): Patch by Matthew Cowles for fixing SF bug # 471918, Generator splitting long headers.
* typed_subpart_iterator(): When getting the main type use 'text' as theBarry Warsaw2001-10-151-2/+2
| | | | | | failobj, and when getting the subtype use 'plain' as the failobj. text/plain is supposed to be the default if the message contains no Content-Type: header.
* HeaderParser: A new subclass of Parser which only parses the messageBarry Warsaw2001-10-111-0/+16
| | | | | | headers. It does not parse the body of the message, instead simply assigning it as a string to the container's payload. This can be much faster when you're only interested in a message's header.
* An audio/* class, like MIMEImage, contributed by Anthony Baxter.Barry Warsaw2001-10-091-0/+71
| | | | | Rewritten for style and the email package naming conventions by Barry.
* Fix __all__ to the current list of exported modules (must pass theBarry Warsaw2001-10-091-3/+4
| | | | tests in test_email.py).
* 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-0412-22/+22
|