[issue18139] email module should have a way to prepend and insert headers
Surya K added the comment: I've done the following changes: 1. create insert_header(): Which places header at the beginning. For that I created set() method which actually takes an argument `pos` default to 0. 2. __setitem__() uses set() (new method) method while fixing `pos` to end. 3. _parse_values(), new method created to not duplicate the code in insert_header() and add_header() since both of them merely do same job. Please let me know your opinions on it. -- keywords: +patch nosy: +Surya.K Added file: http://bugs.python.org/file34278/suryak.patch ___ Python tracker <http://bugs.python.org/issue18139> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18886] BytesGenerator does not handle 'binary' CTE correctly
Surya K added the comment: I have a fix for this. But before putting it forward, can you please tell me about the below 1. email.header.Header.encode() --method How different is it from str.encode()? Does [1] method also performs what str.encode() does internally? -- nosy: +suryak ___ Python tracker <http://bugs.python.org/issue18886> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18886] BytesGenerator does not handle 'binary' CTE correctly
Surya K added the comment: Forget about my previous comment. David Murray: One possible way to fix this issue is to ignore email.header.Header.encode() on Message values in email._policybase_Compat32._fold() if they come from BytesGenerator and not Generator. We can do this by encoding the value to bytes in email.generator.BytesGenerator._write_headers() Do you think its a fix? Or even values from ByteGenerators should be formatted using Header.encode()? In that case, I'd look into how it can be done. -- ___ Python tracker <http://bugs.python.org/issue18886> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18139] email module should have a way to prepend and insert headers
Surya K added the comment: Without really making big the in the API, one way of providing a position sensitive methods to enable more organized headers is to have. Having an index based api probably needs `more` discussion and thought! 1. add_header_before('existing-header-name', 'new-name', value) 2. add_header_after('existing-header-name', 'new-name', value) The `existing-header-name` is again taken by first-found. If put all routing, forwarded headers, one can always use `add_header_before('From'...)`. -- ___ Python tracker <http://bugs.python.org/issue18139> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com