Merge ~cjwatson/launchpad:fix-oauthlib into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 98e0aa032c1df9202435d97769e9b2089da3fa81
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:fix-oauthlib
Merge into: launchpad:master
Diff against target: 13 lines (+1/-1)
1 file modified
lib/lp/services/webapp/servers.py (+1/-1)
Reviewer Review Type Date Requested Status
Tom Wardill (community) Approve
Review via email: mp+394061@code.launchpad.net

Commit message

Fix handling of anonymous requests with oauthlib

Description of the change

RFC 5849 allows omitting the "oauth_token" parameter when empty, whereas OAuth Core 1.0 Revision A didn't; we started running into this in the test suite now that LaunchpadWebServiceCaller uses oauthlib to sign its requests. It's clearly harmless either way, so accept it.

To post a comment you must log in.
Revision history for this message
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py
2index bcf1621..9c47f21 100644
3--- a/lib/lp/services/webapp/servers.py
4+++ b/lib/lp/services/webapp/servers.py
5@@ -1286,7 +1286,7 @@ class WebServicePublication(WebServicePublicationMixin,
6 consumers = getUtility(IOAuthConsumerSet)
7 consumer = consumers.getByKey(consumer_key)
8 token_key = form.get('oauth_token')
9- anonymous_request = (token_key == '')
10+ anonymous_request = not token_key
11
12 if consumer_key is None:
13 # Either the client's OAuth implementation is broken, or

Subscribers

People subscribed via source and target branches

to status/vote changes: