]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
xmlrpc authentication: Fix base64 decoding for py3
authorDaniel Axtens <dja@axtens.net>
Sat, 3 Sep 2016 07:07:19 +0000 (17:07 +1000)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sat, 3 Sep 2016 22:41:12 +0000 (23:41 +0100)
The byte/string distinction in Python 3 requires this messy set of
encode/decode to work.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
patchwork/views/xmlrpc.py

index 65471e7f9e847955e605cb11ffe7cbf5cd71272d..edb75550a691633cb9241aeeabd5c37c8c084c07 100644 (file)
@@ -87,7 +87,7 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher,
         header = header[len('Basic '):].strip()
 
         try:
-            decoded = base64.decodestring(header)
+            decoded = base64.b64decode(header.encode('ascii')).decode('ascii')
             username, password = decoded.split(':', 1)
         except:
             raise Exception('Invalid authentication credentials')