Don't error out in Python 3 if include headers is string (LP: #1776775)

This commit is contained in:
Scott Kitterman
2018-06-16 18:18:45 -04:00
parent 36da46861b
commit f8deb49c0d
3 changed files with 18 additions and 0 deletions
+6
View File
@@ -724,6 +724,12 @@ class DKIM(DomainSigner):
if include_headers is None:
include_headers = self.default_sign_headers()
try:
include_headers = [bytes(x, 'utf-8') for x in include_headers]
except TypeError:
# TypeError means it's already bytes and we're good or we're in
# Python 2 and we don't care. See LP: #1776775.
pass
include_headers = tuple([x.lower() for x in include_headers])
# record what verify should extract