mozilla / django-browserid

Django application for adding BrowserID support.
Mozilla Public License 2.0
179 stars 80 forks source link

WIP: Python3.3 - Make it compatible #187

Closed senden9 closed 11 years ago

senden9 commented 11 years ago

Make django-browserid Python3.3 compatible. The automatic tests say it work with Python 2.6, 2.7 and 3.3 (see the Build Status) but with for 3.2. It should be tested manually or reviewed from other people before release/merge it.

ubernostrum commented 11 years ago

Another incompatibility point is line 102 of django_browserid/base.py -- it's trying to do json.loads on the response from the verification API, but that's a bytes object, and at least for me results in a TypeError ("can't use a string pattern on a bytes-like object") which gets swallowed at line 104. It then, ironically, logs the JSON, including the "status": "okay", for debugging.

Importing force_unicode (with fallback to force_text) in base.py and calling it on r.content when trying to load the JSON resolved this for me.

Osmose commented 11 years ago

Since the verifier patch went up this PR is out of date, and it was proving difficult, so I opened #204. It has most of the fixes from this PR plus a few extras I found when running the tests via tox.

Thanks again @senden9 for the patch, nice work! :D