include_headers has to be a list of bytes on py3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dkimpy |
Fix Released
|
Medium
|
Scott Kitterman |
Bug Description
I've noticed the following test failure with django-ses's tests, when dkimpy is used:
```
Traceback (most recent call last):
File "…/Vcs/
send_
File "…/Vcs/
return mail.send()
File "…/Vcs/
return self.get_
File "…/Vcs/
dkim_
File "…/Vcs/
include_
File "…/Vcs/
return d.sign(selector, domain, privkey, identity=identity, canonicalize=
File "…/Vcs/
raise ParameterError("The From header field MUST be signed")
dkim.ParameterE
```
This is caused, since on py3 `b"foo" in ["foo"]` is False, while it is True on py2.
I think the check should use normal strings, but I see a lot of byte strings being used in the code altogether.
Is `include_headers` meant to be a list of bytes?
(there does not seem to be any documentation, is there?)
Changed in dkimpy: | |
status: | In Progress → Fix Committed |
We use b"foo" throughout dkimpy because getting comparisons to work in both python2 and python3 both is harder otherwise.
It's true that `b"foo" in ["foo"]` is False in python3, but`b"foo" in [b"foo"]` is true.
So yes, bytes.
As far as documentation goes, there isn't much. I'm open to suggestions on how best to document this.