Bug in Python2.7 with futurize lib.
Narsil opened this issue · 4 comments
In views/utils.py
The urlencode load is called with a try except BUT, if futurize was loaded before, from urllib.parse import urlencode will load correctly (but return newstr objects, thus causing error further down the road).
It seems having:
if six.PY3:
from urllib.parse import urlencode
else:
from urllib import urlencode
Would be more correct and fix that precise bug (which we can avoid differently).
Thanks for the fix proposal. However I'm not keen on fixing this issue which is due to using an external package. That try/except
fallback pattern is also widely used in other packages. Moreover, we'll probably drop Python 2 support very soon.
Perfectly fine, I forked for this on our end. I know it's widely used, the proposal because it feels slightly broken compared to real version checking.
Thanks for your understanding.
An alternative solution could be to use django.utils.http.urlencode
instead.