Skip to content

Commit

Permalink
Fix test_logger in Python 3.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
berkerpeksag committed Jul 8, 2015
1 parent da37bcf commit dddfcb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion gunicorn/glogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ def _get_user(self, environ):
auth = http_auth.split(" ", 1)
if len(auth) == 2:
try:
auth = base64.b64decode(auth[1].strip())
# b64decode doesn't accept unicode in Python < 3.3
# so we need to convert it to a byte string
auth = base64.b64decode(auth[1].strip().encode('utf-8'))
if PY3: # b64decode returns a byte string in Python 3
auth = auth.decode('utf-8')
auth = auth.split(":", 1)
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ skipsdist = True

[testenv]
usedevelop = True
commands = py.test tests/
commands = py.test {posargs:tests/}
deps =
-rrequirements_test.txt
py26: unittest2
Expand Down

0 comments on commit dddfcb2

Please sign in to comment.