Merge lp:~verterok/ubuntu-sso-client/fix-910163 into lp:ubuntu-sso-client

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Roberto Alsina
Approved revision: 827
Merged at revision: 826
Proposed branch: lp:~verterok/ubuntu-sso-client/fix-910163
Merge into: lp:ubuntu-sso-client
Diff against target: 28 lines (+2/-2)
1 file modified
ubuntu_sso/credentials.py (+2/-2)
To merge this branch: bzr merge lp:~verterok/ubuntu-sso-client/fix-910163
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
dobey (community) Approve
Review via email: mp+87160@code.launchpad.net

Commit message

Remove _ping_url inlineCallbacks and make it return a deferred in order to make it work with twisted 11.1.

Description of the change

Remove _ping_url inlineCallbacks and make it return a deferred in order to make it work with twisted 11.1.

I didn't add any tests with the change, as the tests are already failing in Precise.

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

This doesn't seem like a proper fix, and it doesn't fix the other methods in the code which have the same problem with twisted >= 11.1.0.

review: Needs Fixing
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

> This doesn't seem like a proper fix, and it doesn't fix the other methods in
> the code which have the same problem with twisted >= 11.1.0.

There are no other methods with @inlineCallbacks and not doing a yield.

It's the easiest way to fix it, as removing @inlineCallbacks we need to reimplement the @handle_failures decorator for synchronous methods, as it's decorating the wrapper with @inlineCallbacks

827. By Guillermo Gonzalez

drop inlineCallbacks decorator and return a deferred instead of doing a yield

Revision history for this message
dobey (dobey) wrote :

The deferred seems like a better fix indeed. :)

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/credentials.py'
2--- ubuntu_sso/credentials.py 2011-08-22 16:21:36 +0000
3+++ ubuntu_sso/credentials.py 2011-12-30 19:00:30 +0000
4@@ -43,6 +43,7 @@
5
6 from functools import wraps
7
8+from twisted.internet import defer
9 from twisted.internet.defer import inlineCallbacks, returnValue
10
11 from ubuntu_sso import NO_OP, utils
12@@ -216,7 +217,6 @@
13 self.denial_cb(app_name)
14
15 @handle_failures(msg='Problem opening the ping_url')
16- @inlineCallbacks
17 def _ping_url(self, app_name, email, credentials):
18 """Ping the self.ping_url with the email attached.
19
20@@ -245,7 +245,7 @@
21 # but the returned deferred will never be fired (nataliabidart).
22 response = urllib2.urlopen(request)
23 logger.debug('Url opened. Response: %s.', response.code)
24- returnValue(response)
25+ return defer.succeed(response)
26
27 @handle_exceptions(msg='Problem opening the Ubuntu SSO user interface')
28 def _show_ui(self, login_only):

Subscribers

People subscribed via source and target branches