Commits

chrislawlor committed f4c3b0d

Bugfixes for retrieving an OAuth request token.

Comments (0)

Files changed (2)

         """Builds the base signature string."""
         key, raw = self.build_signature_base_string(oauth_request, consumer,
             token)
+        
+        # Bugfix https://bitbucket.org/jespern/django-piston/issue/169/oauth-request-token-error-with-hmac
+        key = key.encode('ascii')
 
         # HMAC object.
         try:
 
     def lookup_consumer(self, key):
         try:
-            self.consumer = Consumer.objects.get(key=key)
+            consumer = Consumer.objects.get(key=key)
+            # Bugfix
+            consumer.key = consumer.key.encode('ascii')
+            consumer.secret = consumer.secret.encode('ascii')
+            self.consumer = consumer
             return self.consumer
         except Consumer.DoesNotExist:
             return None