summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-05-29 22:44:43 -0400
committerJason R. Coombs <jaraco@jaraco.com>2018-05-29 22:44:43 -0400
commitcb99e04662c40a826c1d26b07e795cf10da720cc (patch)
treebc57d4d50b120fe05b83ef917145e36b1f5a887c
parent8db545c9bb7d2c32fedd0b9c54dbe46625b1947d (diff)
downloadcherrypy-git-cb99e04662c40a826c1d26b07e795cf10da720cc.tar.gz
Replace ntob(tonative(bytes)) with just bytes
-rw-r--r--cherrypy/lib/auth_basic.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cherrypy/lib/auth_basic.py b/cherrypy/lib/auth_basic.py
index bb933c16..ad379a26 100644
--- a/cherrypy/lib/auth_basic.py
+++ b/cherrypy/lib/auth_basic.py
@@ -23,9 +23,10 @@ as the credentials store::
import binascii
import unicodedata
+import base64
import cherrypy
-from cherrypy._cpcompat import base64_decode, ntob, ntou, tonative
+from cherrypy._cpcompat import ntou, tonative
__author__ = 'visteya'
@@ -84,8 +85,7 @@ def basic_auth(realm, checkpassword, debug=False, accept_charset='utf-8'):
scheme, params = auth_header.split(' ', 1)
if scheme.lower() == 'basic':
charsets = accept_charset, fallback_charset
- decoded_params = base64_decode(params)
- decoded_params = ntob(decoded_params)
+ decoded_params = base64.b64decode(params.encode('ascii'))
decoded_params = _try_decode(decoded_params, charsets)
decoded_params = ntou(decoded_params)
decoded_params = unicodedata.normalize('NFC', decoded_params)