for python-2.6
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 7 Jan 2010 10:18:14 +0000 (10:18 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 7 Jan 2010 10:18:14 +0000 (10:18 +0000)
PLC/Auth.py

index 9fea3e3..b11e855 100644 (file)
@@ -256,7 +256,8 @@ class BootAuth(Auth):
 
             # We encode in UTF-8 before calculating the HMAC, which is
             # an 8-bit algorithm.
-            digest = hmac.new(key, msg.encode('utf-8'), sha).hexdigest()
+            # python 2.6 insists on receiving a 'str' as opposed to a 'unicode'
+            digest = hmac.new(str(key), msg.encode('utf-8'), sha).hexdigest()
 
             if digest != auth['value']:
                 raise PLCAuthenticationFailure, "Call could not be authenticated"