| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
However, the patch in that tracker item is elaborated such that the newly
included unit test pass on Python 2.1 through 2.5. Note that Python 2.1's
uu.decode() does not have a 'quiet' argument, so we have to be sneaky.
Will port to email 3.0 (although without the backward compatible sneakiness).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(.set_payload() gives bad .get_payload() results). Specific changes include:
Simplfy the default CODEC_MAP in Charset.py to not include the Japanese and
Korean codecs. The names of the codecs are different depending on whether
you're using Python 2.4 and 2.5, which include the codecs by default, or
earlier Python's which provide the codecs under different names as a third
party library. Now, we attempt to discover which (if either) is available and
populate the CODEC_MAP as appropriate.
Message.set_charset(): When the message does not already have a
Content-Transfer-Encoding header, instead of just adding the header, we also
encode the body as defined by the assigned Charset. As before, if the
body_encoding is callable, we just call that. If not, then we add a call to
body_encode() before setting the header. This way, we guarantee that a
message's text payload is always encoded properly.
Remove the payload encoding code from Generator._handle_text(). With the
above patch, this would cause the body to be doubly encoded. Doing this in
the Message class is better than only doing it in the Generator.
Added some new tests to ensure everything works correctly. Also changed the
way the test_email_codecs.py tests get added (using the same lookup code that
the CODEC_MAP adjustments use).
This resolves both issues for email 2.5/Python 2.3. I will patch forward to
email 3.0 for both Python 2.4 and 2.5.
|
| |
|
|
|
|
|
|
|
|
| |
name in the Content-Distribution header, so Message.get_filename() should fall
back to using that. Will port both to email 3.0 and Python 2.5 trunk.
Also, bump the email package version to 2.5.7 for eventual release. Of
course, add a test case too.
XXX Need to update the documentation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
an RFC 2231-style header could be bogus or unknown to Python. In that case,
we return the the text part of the parameter undecoded. However, in
get_content_charset(), if that is not ascii, then it is an illegal charset and
so we return failobj.
Test cases and a version bump are included.
Committing this to the Python 2.3 branch because I need to generate an email
2.5.6 release that contains these patches. I will port these fixes to Python
2.4 and 2.5 for email 3.x.
|
| |
|
|
| |
-- but not end -- with whitespace.
|
| | |
|
| |
|
|
|
|
| |
del_param fails when specifying a header.
I'll port this to Python 2.4 shortly.
|
| |
|
|
|
| |
Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
|
| |
|
|
|
|
|
|
|
| |
quotes. Fixes SF bug #794466, with the essential patch provided by
Stuart D. Gathman. Specifically,
_parseparam(), _get_params_preserve(): Use the parsing function that
takes quotes into account, as given (essentially) in the bug report's
test program.
|
| | |
|
| |
|
|
| |
the expected type. In response to SF #751451.
|
| |
|
|
|
| |
it's a convenience only and give hints on what to do for more
flexibility.
|
| |
|
|
| |
Content-Transfer-Encodings
|
| |
|
|
| |
decoding the payload, just return it as-is.
|
| |
|
|
| |
sensitive. Coerce the argument to lower case.
|
| |
|
|
|
|
| |
I seriously doubt this will break any deployed code.
Docstring consistency with the updated .tex files.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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().
|
| |
|
|
| |
reference to the payload.
|
| |
|
|
|
|
| |
Broytmann in SF patch #600096. Specifically, the former function now
encodes the triplets, while the latter adds optional charset and
language arguments.
|
| |
|
|
|
| |
#601959. Modified slightly by Barry (who added the KeyError in case
the header is missing.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 ;).
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
as_string(): Use Generator.flatten() for better performance.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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 ;).
|
| | |
|
| | |
|
| |
|
|
| |
#477864.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
Fix that, and also make the docstring describe failobj.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
<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).
|