diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-03-28 22:49:46 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-03-28 22:49:46 +0100 |
commit | 49f028101342d0b531da9833693f773f19297341 (patch) | |
tree | 7cc6033528a042789d6e4a68004ccc0f3f1378c2 /alot | |
parent | 9914ae79cd22d1fa832ba55f0451314d77edea3c (diff) |
use parse_mailcap_nametemplate in extract_body
.. helper that calls inline mime handler.
This is just to ensure we don't duplicate too much code
Diffstat (limited to 'alot')
-rw-r--r-- | alot/db/utils.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py index 0d28783f..4007606c 100644 --- a/alot/db/utils.py +++ b/alot/db/utils.py @@ -14,6 +14,7 @@ import alot.helper as helper from alot.settings import settings from alot.helper import string_sanitize from alot.helper import string_decode +from alot.helper import parse_mailcap_nametemplate def extract_headers(mail, headers=None): @@ -82,17 +83,10 @@ def extract_body(mail, types=None): if entry: # open tempfile, respect mailcaps nametemplate nametemplate = entry.get('nametemplate', '%s') - nt_list = nametemplate.split('%s') - template_prefix = '' - template_suffix = '' - if len(nt_list) == 2: - template_suffix = nt_list[1] - template_prefix = nt_list[0] - else: - template_suffix = nametemplate + prefix, suffix = parse_mailcap_nametemplate(nametemplate) tmpfile = tempfile.NamedTemporaryFile(delete=False, - prefix=template_prefix, - suffix=template_suffix) + prefix=prefix, + suffix=suffix) # write payload to tmpfile tmpfile.write(raw_payload) tmpfile.close() |