osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add header at top with email.message


Hi,

the EmailMessage class of email.message provides the methods
add_header() and __setitem__() to add a header to a message.
add_header() effectively calls __setitem__(), which does
`self._headers.append(self.policy.header_store_parse(name, val))`.  This
inserts the header at the bottom.

It is, however, sometimes desired to insert a new header at the top of
an (existing) message.  This API doesn?t directly allow this.  In my
opinion, add_header() should have a flag at_top=False or similar, so
that one can get this behaviour (it?ll be a bit difficult with
__setitem__).  What do you think about this?  Is there a feasible way to
do this and change the library?  Should I post it somewhere where the
devs can hear it and suggest that?

Thanks,
	--qsx