[PATCH 7/8] xmlrpc authentication: Fix base64 decoding for py3

Daniel Axtens dja at axtens.net
Sat Sep 3 17:07:19 AEST 2016


The byte/string distinction in Python 3 requires this messy set of
encode/decode to work.

Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 patchwork/views/xmlrpc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
index 65471e7f9e84..edb75550a691 100644
--- a/patchwork/views/xmlrpc.py
+++ b/patchwork/views/xmlrpc.py
@@ -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')
-- 
2.7.4



More information about the Patchwork mailing list