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

2016-08-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: I meant .items() -- ___ Python tracker ___ ___ Python-bugs-list mailing

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

2016-08-22 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: I've updated this to Python 3.6, but I don't know if there's time to design an API and implementation in the time left before beta 1. But a use case has come up, so I want to reboot this discussion (yes, it should go to email-sig too). Apparently ARC

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

2016-08-22 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- versions: +Python 3.6 -Python 3.4 ___ Python tracker ___

[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', 'new-name',

[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 end. 3.

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

2014-03-03 Thread R. David Murray
R. David Murray added the comment: The patch is a reasonable effort, thanks. However, before we can really evaluate any code, we need to agree on an API. The Message object presents a hybrid dictionary/sequence API over the headers. In the Sequence API, we insert something into the list

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

2014-03-03 Thread R. David Murray
R. David Murray added the comment: (Aside: I have no idea why I set the stage to needs patch. The API discussion is needed first!) -- stage: needs patch - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18139

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

2013-06-05 Thread R. David Murray
R. David Murray added the comment: This is by design. I agree, however, that there should be a way to do this when an application needs it, so I'm changing this to a feature request. -- components: +email nosy: +barry, r.david.murray stage: - needs patch title: email module's

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

2013-06-05 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: In a somewhat similar vein, replace_header() retains the original header order. Not quite what the OP wants, but useful. The problem I had originally with a position-aware method is getting the API right. I didn't want to add a position argument to

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

2013-06-05 Thread R. David Murray
R. David Murray added the comment: My preliminary thought (and I haven't checked the code yet to make sure this will actually work), is that under the new email policies we are dealing with full-blown header objects, meaning that they can know the header name they represent. This should