diff options
author | Giovane <giovaneliberato@gmail.com> | 2016-01-21 16:31:14 -0200 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2016-02-08 16:26:58 +0100 |
commit | 1c3b8d861db49ee723a7470301a63a8ca2994f5c (patch) | |
tree | 899bcb548c0dd33fc374aa10d12f4f7af488a64b /src/leap/mail/generator.py | |
parent | 50f0659459169d297fa28ec8f42b7541da970175 (diff) |
[feat] Validate signature with attachments
- Create a new Generator that doesn't trim the headers
- Extract detached signature from message
- Convert message to the body an attachments level
- Add coment to the generator workaround and shows which python version
has the patch
Diffstat (limited to 'src/leap/mail/generator.py')
-rw-r--r-- | src/leap/mail/generator.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/leap/mail/generator.py b/src/leap/mail/generator.py new file mode 100644 index 0000000..28db8da --- /dev/null +++ b/src/leap/mail/generator.py @@ -0,0 +1,21 @@ +from email.generator import Generator as EmailGenerator + +class Generator(EmailGenerator): + """ + Generates output from a Message object tree, keeping signatures. + + This code was extracted from Mailman.Generator.Generator, version 2.1.4: + + Most other Generator will be created not setting the foldheader flag, + as we do not overwrite clone(). The original clone() does not + set foldheaders. + + So you need to set foldheaders if you want the toplevel to fold headers + + TODO: Python 3.3 is patched against this problems. See issue 1590744 on python bug tracker. + """ + def _write_headers(self, msg): + for h, v in msg.items(): + print >> self._fp, '%s:' % h, + print >> self._fp, v + print >> self._fp |