[Mailman-Developers] PGP-signed message verification using the email module (and in Mailman)

Paul Boddie paul at boddie.org.uk
Sat Jan 11 19:06:41 CET 2014


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


More information about the Mailman-Developers mailing list