[issue18139] email module should have a way to prepend and insert headers

2014-03-04 Thread Surya K
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',

[issue18886] BytesGenerator does not handle 'binary' CTE correctly

2014-03-04 Thread Surya K
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

[issue18886] BytesGenerator does not handle 'binary' CTE correctly

2014-03-04 Thread Surya K
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

[issue18139] email module should have a way to prepend and insert headers

2014-03-03 Thread Surya K
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 e