From 22d370ca0f51e1ce692d354dc42b4c4719b945e0 Mon Sep 17 00:00:00 2001 From: David Tran Date: Tue, 21 Dec 2010 22:18:19 -0800 Subject: [PATCH] Fix for OAuthRequest.to_postdata() and OAuthRequest.to_header() not properly handling unicode strings (changed str --> _utf8_str) --- oauth/oauth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oauth/oauth.py b/oauth/oauth.py index 286de18..a9f853c 100644 --- a/oauth/oauth.py +++ b/oauth/oauth.py @@ -206,12 +206,12 @@ def to_header(self, realm=''): if self.parameters: for k, v in self.parameters.iteritems(): if k[:6] == 'oauth_': - auth_header += ', %s="%s"' % (k, escape(str(v))) + auth_header += ', %s="%s"' % (k, escape(_utf8_str(v))) return {'Authorization': auth_header} def to_postdata(self): """Serialize as post data for a POST request.""" - return '&'.join(['%s=%s' % (escape(str(k)), escape(str(v))) \ + return '&'.join(['%s=%s' % (escape(_utf8_str(k)), escape(_utf8_str(v))) \ for k, v in self.parameters.iteritems()]) def to_url(self):