On Thursday 9. January 2014 01.49.14 Paul Boddie wrote:
> 
> I just searched for bugs reported about this and found the following:
> 
> http://bugs.python.org/issue1974 (covers the change from tab to space
> indents) http://bugs.python.org/issue1372770 (covers issues of header
> folding) http://bugs.python.org/issue11492 (also covers header folding)
> http://bugs.python.org/issue1440472 (actually mentions a lack of
> idempotency)
> 
> I think the last one probably answers my question, but I'll look at it
> again tomorrow. This may mean that I have to write my own message
> serialiser, of course.

Following up to myself, here's what I decided to do for now:

    out = StringIO()
    generator = Generator(out, False, 0) # disable reformatting measures
    generator.flatten(message)
    return out.getvalue()

Problems may apparently remain with superfluous whitespace found around header 
keys in any parsed messages, but the above seems to prevent the blatant 
rewriting I experienced with the Message.as_string method, doing so by 
overriding the Generator defaults.

Paul
_______________________________________________
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to