From 5c53edfba561a2ebdca2741c92405dbd69bd469c Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 3 Aug 2018 10:34:17 -0700 Subject: db/attachment: use set_param() instead of recreating a header This is more elegant and efficient way to handle this. --- alot/db/attachment.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'alot') diff --git a/alot/db/attachment.py b/alot/db/attachment.py index 2868ed66..73fbf093 100644 --- a/alot/db/attachment.py +++ b/alot/db/attachment.py @@ -1,10 +1,10 @@ # Copyright (C) 2011-2012 Patrick Totzke +# Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file import os import tempfile import email.charset as charset -from email.header import Header from copy import deepcopy from ..helper import string_decode, humanize_size, guess_mimetype @@ -86,8 +86,5 @@ class Attachment(object): def get_mime_representation(self): """returns mime part that constitutes this attachment""" part = deepcopy(self.part) - part['Content-Disposition'] = Header( - self.part['Content-Disposition'], - maxlinelen=78, - header_name='Content-Disposition').encode() + part.set_param('maxlinelen', '78', header='Content-Disposition') return part -- cgit v1.2.3