From 371728041519a3a76fe05e4fca9a7169ea1bb49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=99=A5=20Ivan=20Tam=20=E2=99=A5?= Date: Mon, 12 Nov 2012 19:11:00 +0000 Subject: [PATCH] LOGGLY-1675, fix hmac raising TypeError --- piston/store.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/piston/store.py b/piston/store.py index f0642ad..6804ab4 100644 --- a/piston/store.py +++ b/piston/store.py @@ -13,6 +13,11 @@ def __init__(self, oauth_request): def lookup_consumer(self, key): try: self.consumer = Consumer.objects.get(key=key) + + # LOGGLY-1675, Unicoded Consumers cause hmac.new() to raise TypeError + self.consumer.key = self.consumer.key.encode('ascii') + self.consumer.secret = self.consumer.secret.encode('ascii') + return self.consumer except Consumer.DoesNotExist: return None