only parse header when accessing header fields
authorAndrew Engelbrecht <sudoman@ninthfloor.org>
Wed, 20 Jan 2016 21:55:16 +0000 (16:55 -0500)
committerAndrew Engelbrecht <sudoman@ninthfloor.org>
Wed, 20 Jan 2016 21:55:16 +0000 (16:55 -0500)
this is a simple performance improvement.

edward

diff --git a/edward b/edward
index 3cbede14511bbf992edf8092d2e9737b681b1432..fd909c634b4ae6077a677847d6d99e40d39fb19a 100755 (executable)
--- a/edward
+++ b/edward
@@ -1251,7 +1251,7 @@ def email_to_from_subject (email_bytes):
         the email To:, From:, and Subject: fields as strings
     """
 
-    email_struct = email.parser.BytesParser().parsebytes(email_bytes)
+    email_struct = email.parser.BytesHeaderParser().parsebytes(email_bytes)
 
     email_to        = email_struct['To']
     email_from      = email_struct['From']