Merge lp:~tcole/oauth/unicode-safe into lp:oauth

Proposed by Tim Cole
Status: Needs review
Proposed branch: lp:~tcole/oauth/unicode-safe
Merge into: lp:oauth
Diff against target: 19 lines (+2/-2)
1 file modified
oauth/oauth.py (+2/-2)
To merge this branch: bzr merge lp:~tcole/oauth/unicode-safe
Reviewer Review Type Date Requested Status
VCS imports Pending
Review via email: mp+62731@code.launchpad.net

Description of the change

Some software insists on putting (ascii subset) unicode strings through oauth; this has worked until now, but blows up under python 2.7. (Because HMAC doesn't work with unicode objects.)

To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

At the moment you are encoding them using whatever Python's default
is. I think it would be both a bit clearer and a bit less likely to
cause confusing errors if you instead made it thing.encode('ascii',
'error') if they're really required to be always ascii safe.

Unmerged revisions

59. By Tim Cole

don't blow up under python 2.7 if unicode strings are supplied

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'oauth/oauth.py'
2--- oauth/oauth.py 2009-10-20 21:45:08 +0000
3+++ oauth/oauth.py 2011-05-27 19:31:34 +0000
4@@ -618,7 +618,7 @@
5 if token:
6 key += escape(token.secret)
7 raw = '&'.join(sig)
8- return key, raw
9+ return str(key), str(raw)
10
11 def build_signature(self, oauth_request, consumer, token):
12 """Builds the base signature string."""
13@@ -652,4 +652,4 @@
14 def build_signature(self, oauth_request, consumer, token):
15 key, raw = self.build_signature_base_string(oauth_request, consumer,
16 token)
17- return key
18\ No newline at end of file
19+ return key

Subscribers

People subscribed via source and target branches

to all changes: