summaryrefslogtreecommitdiffstats
path: root/Lib/email/generator.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge: #19003: Only replace \r and/or \n line endings in email.generator.R David Murray2016-09-111-6/+10
|
* Merge: #27630: Be consistent in how _XXX/_encoded_XXX vars are initialized.R David Murray2016-09-091-9/+1
|\
| * #27630: Be consistent in how _XXX/_encoded_XXX vars are initialized.R David Murray2016-09-091-9/+1
| |
* | Add policy keyword to email.generator.DecodedGenerator.R David Murray2016-09-081-2/+4
| |
* | Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|/
* #20098: add mangle_from_ policy option.R David Murray2015-05-171-5/+8
| | | | | | | This defaults to True in the compat32 policy for backward compatibility, but to False for all new policies. Patch by Milan Oberkirch, with a few tweaks.
* #21300: Clean up the docs for the email "policy" arguments.R David Murray2014-05-071-3/+6
|
* Issue #20976: pyflakes: Remove unused importsVictor Stinner2014-03-201-4/+0
|
* #14983: always add a line end after a MIME boundary marker.R David Murray2014-02-081-2/+1
| | | | | | | | | This is more RFC compliant (see issue) and fixes a problem with signature verifiers rejecting the part when signed. There is some amount of backward compatibility concern here since it changes the output, but the RFC issue coupled with fixing the problem with signature verifiers seems worth the small risk of breaking code that depends on the current incorrect output.
* #19772: Do not mutate message when downcoding to 7bit.R David Murray2014-02-081-0/+14
| | | | | | | | | This is a bit of an ugly hack because of the way generator pieces together the output message. The deepcopys aren't too expensive, though, because we know it is only called on messages that are not multiparts, and the payload (the thing that could be large) is an immutable object. Test and preliminary work on patch by Vajrasky Kok.
* Fix a couple of typos.Ezio Melotti2013-08-101-1/+1
|
* Merge: PEP8 fixup on previous patch, remove unused imports in test_email.R David Murray2013-03-071-1/+1
|\
| * PEP8 fixup on previous patch, remove unused import in test_email.R David Murray2013-03-071-1/+1
| |
* | Merge: #14645: Generator now emits correct linesep for all parts.R David Murray2013-03-071-4/+18
|\ \ | |/ | | | | | | | | | | | | | | | | Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix.
| * #14645: Generator now emits correct linesep for all parts.R David Murray2013-03-071-4/+18
| | | | | | | | | | | | | | | | | | | | Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix.
* | Merge: #16564: Fix regression in use of encoders.encode_noop with binary data.R David Murray2013-02-091-0/+3
|\ \ | |/
| * #16564: Fix regression in use of encoders.encode_noop with binary data.R David Murray2013-02-091-0/+3
| |
* | Merge #15249: Mangle From lines correctly when body contains invalid bytes.R David Murray2012-08-241-0/+2
|\ \ | |/ | | | | Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
| * #15249: Mangle From lines correctly when body contains invalid bytes.R David Murray2012-08-241-0/+2
| | | | | | | | Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
* | Merge #15232: correctly mangle From lines in MIME preamble and epilogueR David Murray2012-07-231-2/+10
|\ \ | |/
| * #15232: correctly mangle From lines in MIME preamble and epilogueR David Murray2012-07-231-2/+10
| |
* | #12586: add provisional email policy with new header parsing and folding.R David Murray2012-05-251-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When the new policies are used (and only when the new policies are explicitly used) headers turn into objects that have attributes based on their parsed values, and can be set using objects that encapsulate the values, as well as set directly from unicode strings. The folding algorithm then takes care of encoding unicode where needed, and folding according to the highest level syntactic objects. With this patch only date and time headers are parsed as anything other than unstructured, but that is all the helper methods in the existing API handle. I do plan to add more parsers, and complete the set specified in the RFC before the package becomes stable.
* | #14731: refactor email policy framework.R David Murray2012-05-251-51/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch primarily does two things: (1) it adds some internal-interface methods to Policy that allow for Policy to control the parsing and folding of headers in such a way that we can construct a backward compatibility policy that is 100% compatible with the 3.2 API, while allowing a new policy to implement the email6 API. (2) it adds that backward compatibility policy and refactors the test suite so that the only differences between the 3.2 test_email.py file and the 3.3 test_email.py file is some small changes in test framework and the addition of tests for bugs fixed that apply to the 3.2 API. There are some additional teaks, such as moving just the code needed for the compatibility policy into _policybase, so that the library code can import only _policybase. That way the new code that will be added for email6 will only get imported when a non-compatibility policy is imported.
* | Merge #11686: add missing entries to email __all__ lists.R David Murray2012-03-171-1/+1
|\ \ | |/ | | | | Original patch by Steffen Daode Nurpmeso
| * #11686: add missing entries to email __all__ lists.R David Murray2012-03-171-1/+1
| | | | | | | | Original patch by Steffen Daode Nurpmeso
* | #14062: fix BytesParser handling of Header objectsR David Murray2012-03-141-0/+3
|\ \ | |/ | | | | | | | | This is a different fix than the 3.2 fix, but the new tests are the same. This also affected smtplib.SMTP.send_message, which calls BytesParser.
| * #14062: fix BytesParser handling of linesep for Header objectsR David Murray2012-03-141-1/+1
| | | | | | | | This also affected smtplib.SMTP.send_message, which calls BytesParser.
* | #11731: simplify/enhance parser/generator API by introducing policy objects.R David Murray2011-04-181-25/+37
| | | | | | | | | | | | | | | | This new interface will also allow for future planned enhancements in control over the parser/generator without requiring any additional complexity in the parser/generator API. Patch reviewed by Éric Araujo and Barry Warsaw.
* | #11684: Complete parser bytes interface by adding BytesHeaderParserR David Murray2011-04-131-1/+3
|/ | | | Patch by Steffen Daode Nurpmeso.
* Harmonize linesep docstrings, and fix the quoting of \r\nR David Murray2011-03-141-2/+5
|
* #11019: Make BytesGenerator handle Message with None body.R. David Murray2011-01-261-0/+2
| | | | Bug discovery and initial patch by Victor Stinner.
* Revert r88197. I'll refix correctly once there is a test.R. David Murray2011-01-261-5/+2
|
* Fix BytesGenerator._handle_text() if the message has no payload (None)Victor Stinner2011-01-261-2/+5
|
* Fix the change made for issue 1243654.R. David Murray2010-12-211-1/+2
| | | | Surprisingly, it turns out there was no test that exercised this code path.
* #243654: only create a new MIME boundary if we don't already have one.R. David Murray2010-12-121-12/+6
| | | | | | The rearranged code should do exactly what the old code did, but the new code avoids a potentially costly re computation in the case where a boundary already exists.
* Fix TestBytesGeneratorIdempotent tests and a couple bugs they revealed.R. David Murray2010-11-211-2/+2
| | | | | | | | | The tests that were failing on (some) windows machines, where the msg_XX.txt files used native \r\n lineseps are now also run on machines that use \n natively, and conversely the \n tests are run on Windows. The failing tests revealed one place where linesep needed to be added to a flatten call in generator. There was also another that the tests didn't catch, so I added a test for that case as well.
* #1349106: add linesep argument to generator.flatten and header.encode.R. David Murray2010-10-231-31/+43
|
* #4661: add bytes parsing and generation to email (email version bump to 5.1.0)R. David Murray2010-10-081-43/+143
| | | | | | | | The work on this is not 100% complete, but everything is present to allow real-world testing of the code. The only remaining major todo item is to (hopefully!) enhance the handling of non-ASCII bytes in headers converted to unicode by RFC2047 encoding them rather than replacing them with '?'s.
* Fix docstring typo.R. David Murray2010-10-011-1/+1
|
* Merged revisions 78274 via svnmerge fromR. David Murray2010-02-211-2/+10
| | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78274 | r.david.murray | 2010-02-20 23:23:00 -0500 (Sat, 20 Feb 2010) | 9 lines Issue 7970: When email.Parser.Parser parses a MIME message of type message/rfc822 it turns it into an object whose body consists of a list containing a single Message object. HeaderParser, on the other hand, just copies the body as a string. Generator.flatten has a special handler for the message mime type that expected the body to be the one item list. This fails if the message was parsed by HeaderParser. So we now check to see if the body is a string first, and if so just we just emit it. ........
* Merged revisions 77517,77525 via svnmerge fromR. David Murray2010-01-161-0/+11
| | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk Merge adds an additional test for as_string with a maxheaderlen specified. ........ r77517 | r.david.murray | 2010-01-16 00:15:17 -0500 (Sat, 16 Jan 2010) | 6 lines Issue #1670765: Prevent email.generator.Generator from re-wrapping headers in multipart/signed MIME parts, which fixes one of the sources of invalid modifications to such parts by Generator. Patch and tests by Martin von Gagern. ........ r77525 | r.david.murray | 2010-01-16 11:08:32 -0500 (Sat, 16 Jan 2010) | 2 lines Fix issue number in comment. ........
* Merged revisions 77209,77229,77359-77360,77371 via svnmerge fromBenjamin Peterson2010-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77209 | georg.brandl | 2010-01-01 07:07:05 -0600 (Fri, 01 Jan 2010) | 1 line More yearly updates. ........ r77229 | georg.brandl | 2010-01-02 06:35:01 -0600 (Sat, 02 Jan 2010) | 1 line Fix casing. ........ r77359 | georg.brandl | 2010-01-07 14:54:45 -0600 (Thu, 07 Jan 2010) | 1 line Fix description for Py_GetPath(); it sounded like it always returned sys.path. ........ r77360 | georg.brandl | 2010-01-07 15:48:47 -0600 (Thu, 07 Jan 2010) | 1 line #7653: clarify how the PythonPath registry key should look like. ........ r77371 | senthil.kumaran | 2010-01-08 13:20:25 -0600 (Fri, 08 Jan 2010) | 3 lines Fix for Issue7026. For the Error - RuntimeError: dictionary changed size during iteration ........
* "Port" the fix for issue 1974 from the trunk (2.7). Because Python 3.x does ↵Barry Warsaw2009-03-301-1/+1
| | | | | | things much better, less changes are necessary. This also shoves test_email_codecs_rename.py onto test_email_codecs.py even though the test needs to be ported to Python 3.
* Removed PyInt_GetMax and sys.maxintChristian Heimes2007-12-041-2/+2
| | | | | I replaced sys.maxint with sys.maxsize in Lib/*.py. Does anybody see a problem with the change on Win 64bit platforms? Win 64's long is just 32bit but the sys.maxsize is now 2**63-1 on every 64bit platform. Also added docs for sys.maxsize.
* Patch# 1258 by Christian Heimes: kill basestring.Guido van Rossum2007-10-161-3/+3
| | | | I like this because it makes the code shorter! :-)
* Oops. I copied a slightly older version of the email package from the sandbox.Guido van Rossum2007-08-301-6/+2
| | | | | | | This should restore the email package in the py3k branch to exactly what's in the sandbox. This wipes out 1-2 fixes made post-copy, which I'll re-apply shortly.
* Copying the email package back, despite its failings.Guido van Rossum2007-08-301-0/+332
|
* Remove the email package for now.Guido van Rossum2007-08-251-354/+0
| | | | | | Once Barry and the email-sig have a working new version we'll add it back. If it doesn't make the 3.0a deadline (release August 31), too bad.
* SF patch# 1770008 by Christian Heimes (plus some extras).Guido van Rossum2007-08-091-1/+1
| | | | | | | | | | Completely get rid of StringIO.py and cStringIO.c. I had to fix a few tests and modules beyond what Christian did, and invent a few conventions. E.g. in elementtree, I chose to write/return Unicode strings whe no encoding is given, but bytes when an explicit encoding is given. Also mimetools was made to always assume binary files.
* SF patch# 1757839 by Alexandre Vassalotti -- make test_mailbox andGuido van Rossum2007-07-211-2/+8
| | | | test_old_mailbox pass.