Merge lp:~ralsina/ubuntu-sso-client/no-thread-execute into lp:ubuntu-sso-client

Proposed by Roberto Alsina
Status: Merged
Approved by: Roberto Alsina
Approved revision: 748
Merged at revision: 745
Proposed branch: lp:~ralsina/ubuntu-sso-client/no-thread-execute
Merge into: lp:ubuntu-sso-client
Diff against target: 374 lines (+38/-39)
7 files modified
ubuntu_sso/main/__init__.py (+8/-6)
ubuntu_sso/main/linux.py (+6/-6)
ubuntu_sso/main/tests/test_common.py (+6/-7)
ubuntu_sso/main/tests/test_linux.py (+5/-5)
ubuntu_sso/main/tests/test_windows.py (+6/-7)
ubuntu_sso/main/windows.py (+6/-6)
ubuntu_sso/networkstate/windows.py (+1/-2)
To merge this branch: bzr merge lp:~ralsina/ubuntu-sso-client/no-thread-execute
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
Review via email: mp+69280@code.launchpad.net

Commit message

Remove the thread_execute arguments.

Description of the change

Remove the thread_execute arguments.

To post a comment you must log in.
747. By Roberto Alsina

fix EOLs

748. By Roberto Alsina

lint fixes

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Looks fine, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_sso/main/__init__.py'
--- ubuntu_sso/main/__init__.py 2011-07-14 18:58:00 +0000
+++ ubuntu_sso/main/__init__.py 2011-07-26 15:38:26 +0000
@@ -75,7 +75,7 @@
75 self.processor = self.sso_login_processor_class(75 self.processor = self.sso_login_processor_class(
76 sso_service_class=sso_service_class)76 sso_service_class=sso_service_class)
7777
78 def generate_captcha(self, app_name, filename, thread_execute, result_cb,78 def generate_captcha(self, app_name, filename, result_cb,
79 error_cb):79 error_cb):
80 """Call the matching method in the processor."""80 """Call the matching method in the processor."""
81 def f():81 def f():
@@ -84,7 +84,7 @@
84 thread_execute(f, app_name, result_cb, error_cb)84 thread_execute(f, app_name, result_cb, error_cb)
8585
86 def register_user(self, app_name, email, password, name, captcha_id,86 def register_user(self, app_name, email, password, name, captcha_id,
87 captcha_solution, thread_execute, result_cb, error_cb):87 captcha_solution, result_cb, error_cb):
88 """Call the matching method in the processor."""88 """Call the matching method in the processor."""
89 def f():89 def f():
90 """Inner function that will be run in a thread."""90 """Inner function that will be run in a thread."""
@@ -92,7 +92,7 @@
92 captcha_id, captcha_solution)92 captcha_id, captcha_solution)
93 thread_execute(f, app_name, result_cb, error_cb)93 thread_execute(f, app_name, result_cb, error_cb)
9494
95 def login(self, app_name, email, password, thread_execute, result_cb,95 def login(self, app_name, email, password, result_cb,
96 error_cb, not_validated_cb):96 error_cb, not_validated_cb):
97 """Call the matching method in the processor."""97 """Call the matching method in the processor."""
98 def f():98 def f():
@@ -121,7 +121,7 @@
121 thread_execute(f, app_name, success_cb, error_cb)121 thread_execute(f, app_name, success_cb, error_cb)
122122
123 def validate_email(self, app_name, email, password, email_token,123 def validate_email(self, app_name, email, password, email_token,
124 thread_execute, result_cb, error_cb):124 result_cb, error_cb):
125 """Call the matching method in the processor."""125 """Call the matching method in the processor."""
126126
127 def f():127 def f():
@@ -141,7 +141,7 @@
141141
142 thread_execute(f, app_name, success_cb, error_cb)142 thread_execute(f, app_name, success_cb, error_cb)
143143
144 def request_password_reset_token(self, app_name, email, thread_execute,144 def request_password_reset_token(self, app_name, email,
145 result_cb, error_cb):145 result_cb, error_cb):
146 """Call the matching method in the processor."""146 """Call the matching method in the processor."""
147 def f():147 def f():
@@ -150,7 +150,7 @@
150 thread_execute(f, app_name, result_cb, error_cb)150 thread_execute(f, app_name, result_cb, error_cb)
151151
152 def set_new_password(self, app_name, email, token, new_password,152 def set_new_password(self, app_name, email, token, new_password,
153 thread_execute, result_cb, error_cb):153 result_cb, error_cb):
154 """Call the matching method in the processor."""154 """Call the matching method in the processor."""
155 def f():155 def f():
156 """Inner function that will be run in a thread."""156 """Inner function that will be run in a thread."""
@@ -410,8 +410,10 @@
410 SSOCredentials = windows.SSOCredentials410 SSOCredentials = windows.SSOCredentials
411 CredentialsManagement = windows.CredentialsManagement411 CredentialsManagement = windows.CredentialsManagement
412 TIMEOUT_INTERVAL = 10000000000 # forever412 TIMEOUT_INTERVAL = 10000000000 # forever
413 thread_execute = windows.blocking
413else:414else:
414 from ubuntu_sso.main import linux415 from ubuntu_sso.main import linux
415 SSOLogin = linux.SSOLogin416 SSOLogin = linux.SSOLogin
416 SSOCredentials = linux.SSOCredentials417 SSOCredentials = linux.SSOCredentials
417 CredentialsManagement = linux.CredentialsManagement418 CredentialsManagement = linux.CredentialsManagement
419 thread_execute = linux.blocking
418420
=== modified file 'ubuntu_sso/main/linux.py'
--- ubuntu_sso/main/linux.py 2011-04-25 18:41:34 +0000
+++ ubuntu_sso/main/linux.py 2011-07-26 15:38:26 +0000
@@ -92,7 +92,7 @@
92 in_signature='ss')92 in_signature='ss')
93 def generate_captcha(self, app_name, filename):93 def generate_captcha(self, app_name, filename):
94 """Call the matching method in the processor."""94 """Call the matching method in the processor."""
95 self.root.generate_captcha(app_name, filename, blocking,95 self.root.generate_captcha(app_name, filename,
96 self.CaptchaGenerated,96 self.CaptchaGenerated,
97 self.CaptchaGenerationError)97 self.CaptchaGenerationError)
9898
@@ -115,7 +115,7 @@
115 captcha_id, captcha_solution):115 captcha_id, captcha_solution):
116 """Call the matching method in the processor."""116 """Call the matching method in the processor."""
117 self.root.register_user(app_name, email, password, name, captcha_id,117 self.root.register_user(app_name, email, password, name, captcha_id,
118 captcha_solution, blocking,118 captcha_solution,
119 self.UserRegistered,119 self.UserRegistered,
120 self.UserRegistrationError)120 self.UserRegistrationError)
121121
@@ -142,7 +142,7 @@
142 in_signature='sss')142 in_signature='sss')
143 def login(self, app_name, email, password):143 def login(self, app_name, email, password):
144 """Call the matching method in the processor."""144 """Call the matching method in the processor."""
145 self.root.login(app_name, email, password, blocking, self.LoggedIn,145 self.root.login(app_name, email, password, self.LoggedIn,
146 self.LoginError, self.UserNotValidated)146 self.LoginError, self.UserNotValidated)
147147
148 # validate_email signals148 # validate_email signals
@@ -163,7 +163,7 @@
163 def validate_email(self, app_name, email, password, email_token):163 def validate_email(self, app_name, email, password, email_token):
164 """Call the matching method in the processor."""164 """Call the matching method in the processor."""
165 self.root.validate_email(app_name, email, password, email_token,165 self.root.validate_email(app_name, email, password, email_token,
166 blocking, self.EmailValidated,166 self.EmailValidated,
167 self.EmailValidationError)167 self.EmailValidationError)
168168
169 # request_password_reset_token signals169 # request_password_reset_token signals
@@ -183,7 +183,7 @@
183 in_signature='ss')183 in_signature='ss')
184 def request_password_reset_token(self, app_name, email):184 def request_password_reset_token(self, app_name, email):
185 """Call the matching method in the processor."""185 """Call the matching method in the processor."""
186 self.root.request_password_reset_token(app_name, email, blocking,186 self.root.request_password_reset_token(app_name, email,
187 self.PasswordResetTokenSent,187 self.PasswordResetTokenSent,
188 self.PasswordResetError)188 self.PasswordResetError)
189189
@@ -205,7 +205,7 @@
205 def set_new_password(self, app_name, email, token, new_password):205 def set_new_password(self, app_name, email, token, new_password):
206 """Call the matching method in the processor."""206 """Call the matching method in the processor."""
207 self.root.set_new_password(app_name, email, token, new_password,207 self.root.set_new_password(app_name, email, token, new_password,
208 blocking, self.PasswordChanged,208 self.PasswordChanged,
209 self.PasswordChangeError)209 self.PasswordChangeError)
210210
211211
212212
=== modified file 'ubuntu_sso/main/tests/test_common.py'
--- ubuntu_sso/main/tests/test_common.py 2011-03-31 09:33:48 +0000
+++ ubuntu_sso/main/tests/test_common.py 2011-07-26 15:38:26 +0000
@@ -75,7 +75,7 @@
75 """Test that the call is relayed."""75 """Test that the call is relayed."""
76 app_name = 'app'76 app_name = 'app'
77 filename = 'file'77 filename = 'file'
78 self.root.generate_captcha(app_name, filename, MATCH(callable),78 self.root.generate_captcha(app_name, filename,
79 MATCH(callable), MATCH(callable))79 MATCH(callable), MATCH(callable))
80 self.mocker.replay()80 self.mocker.replay()
81 self.login.generate_captcha(app_name, filename)81 self.login.generate_captcha(app_name, filename)
@@ -89,7 +89,7 @@
89 captcha_id = 'id'89 captcha_id = 'id'
90 captcha_solution = 'hello'90 captcha_solution = 'hello'
91 self.root.register_user(app_name, email, password, name, captcha_id,91 self.root.register_user(app_name, email, password, name, captcha_id,
92 captcha_solution, MATCH(callable),92 captcha_solution,
93 MATCH(callable), MATCH(callable))93 MATCH(callable), MATCH(callable))
94 self.mocker.replay()94 self.mocker.replay()
95 self.login.register_user(app_name, email, password, name, captcha_id,95 self.login.register_user(app_name, email, password, name, captcha_id,
@@ -100,7 +100,7 @@
100 app_name = 'app'100 app_name = 'app'
101 email = 'email'101 email = 'email'
102 password = 'password'102 password = 'password'
103 self.root.login(app_name, email, password, MATCH(callable),103 self.root.login(app_name, email, password,
104 MATCH(callable), MATCH(callable),104 MATCH(callable), MATCH(callable),
105 MATCH(callable))105 MATCH(callable))
106 self.mocker.mock()106 self.mocker.mock()
@@ -114,18 +114,17 @@
114 password = 'passwrd'114 password = 'passwrd'
115 email_token = 'token'115 email_token = 'token'
116 self.root.validate_email(app_name, email, password, email_token,116 self.root.validate_email(app_name, email, password, email_token,
117 MATCH(callable), MATCH(callable),117 MATCH(callable),
118 MATCH(callable))118 MATCH(callable))
119 self.mocker.replay()119 self.mocker.replay()
120 self.login.validate_email(app_name, email, password, email_token)120 self.login.validate_email(app_name, email, password, email_token)
121121
122 def test_request_password_reset_tolen(self):122 def test_request_password_reset_token(self):
123 """Test that the call is relayed."""123 """Test that the call is relayed."""
124 app_name = 'app'124 app_name = 'app'
125 email = 'email'125 email = 'email'
126 self.root.request_password_reset_token(app_name, email,126 self.root.request_password_reset_token(app_name, email,
127 MATCH(callable),127 MATCH(callable),
128 MATCH(callable),
129 MATCH(callable))128 MATCH(callable))
130 self.mocker.replay()129 self.mocker.replay()
131 self.login.request_password_reset_token(app_name, email)130 self.login.request_password_reset_token(app_name, email)
@@ -137,7 +136,7 @@
137 token = 'token'136 token = 'token'
138 new_password = 'new'137 new_password = 'new'
139 self.root.set_new_password(app_name, email, token, new_password,138 self.root.set_new_password(app_name, email, token, new_password,
140 MATCH(callable), MATCH(callable),139 MATCH(callable),
141 MATCH(callable))140 MATCH(callable))
142 self.mocker.replay()141 self.mocker.replay()
143 self.login.set_new_password(app_name, email, token, new_password)142 self.login.set_new_password(app_name, email, token, new_password)
144143
=== modified file 'ubuntu_sso/main/tests/test_linux.py'
--- ubuntu_sso/main/tests/test_linux.py 2011-03-31 03:52:10 +0000
+++ ubuntu_sso/main/tests/test_linux.py 2011-07-26 15:38:26 +0000
@@ -144,7 +144,7 @@
144 expected_result = "expected result"144 expected_result = "expected result"
145 self.create_mock_processor().generate_captcha(filename)145 self.create_mock_processor().generate_captcha(filename)
146 self.mocker.result(expected_result)146 self.mocker.result(expected_result)
147 self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking)147 self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking)
148 self.mocker.replay()148 self.mocker.replay()
149149
150 def verify(app_name, errdict):150 def verify(app_name, errdict):
@@ -191,7 +191,7 @@
191 self.create_mock_processor().register_user(EMAIL, PASSWORD, NAME,191 self.create_mock_processor().register_user(EMAIL, PASSWORD, NAME,
192 CAPTCHA_ID, CAPTCHA_SOLUTION)192 CAPTCHA_ID, CAPTCHA_SOLUTION)
193 self.mocker.result(expected_result)193 self.mocker.result(expected_result)
194 self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking)194 self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking)
195 self.mocker.replay()195 self.mocker.replay()
196196
197 def verify(app_name, errdict):197 def verify(app_name, errdict):
@@ -377,7 +377,7 @@
377 d = Deferred()377 d = Deferred()
378 processor = self.create_mock_processor()378 processor = self.create_mock_processor()
379 processor.request_password_reset_token(EMAIL)379 processor.request_password_reset_token(EMAIL)
380 self.patch(ubuntu_sso.main.linux, "blocking", fake_ok_blocking)380 self.patch(ubuntu_sso.main, "thread_execute", fake_ok_blocking)
381 self.mocker.result(EMAIL)381 self.mocker.result(EMAIL)
382 self.mocker.replay()382 self.mocker.replay()
383383
@@ -400,7 +400,7 @@
400400
401 self.create_mock_processor().request_password_reset_token(EMAIL)401 self.create_mock_processor().request_password_reset_token(EMAIL)
402 self.mocker.result(EMAIL)402 self.mocker.result(EMAIL)
403 self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking)403 self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking)
404 self.mocker.replay()404 self.mocker.replay()
405405
406 def verify(app_name, errdict):406 def verify(app_name, errdict):
@@ -446,7 +446,7 @@
446 self.create_mock_processor().set_new_password(EMAIL, EMAIL_TOKEN,446 self.create_mock_processor().set_new_password(EMAIL, EMAIL_TOKEN,
447 PASSWORD)447 PASSWORD)
448 self.mocker.result(expected_result)448 self.mocker.result(expected_result)
449 self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking)449 self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking)
450 self.mocker.replay()450 self.mocker.replay()
451451
452 def verify(app_name, errdict):452 def verify(app_name, errdict):
453453
=== modified file 'ubuntu_sso/main/tests/test_windows.py'
--- ubuntu_sso/main/tests/test_windows.py 2011-07-13 19:47:18 +0000
+++ ubuntu_sso/main/tests/test_windows.py 2011-07-26 15:38:26 +0000
@@ -30,7 +30,6 @@
30)30)
31from ubuntu_sso.main import windows31from ubuntu_sso.main import windows
32from ubuntu_sso.main.windows import (32from ubuntu_sso.main.windows import (
33 blocking,
34 signal,33 signal,
35 CredentialsManagement,34 CredentialsManagement,
36 CredentialsManagementClient,35 CredentialsManagementClient,
@@ -292,7 +291,7 @@
292 @defer.inlineCallbacks291 @defer.inlineCallbacks
293 def test_execution(client):292 def test_execution(client):
294 """Actual test."""293 """Actual test."""
295 self.root.generate_captcha(app_name, filename, blocking,294 self.root.generate_captcha(app_name, filename,
296 self.login.emit_captcha_generated,295 self.login.emit_captcha_generated,
297 self.login.emit_captcha_generation_error)296 self.login.emit_captcha_generation_error)
298 self.mocker.replay()297 self.mocker.replay()
@@ -364,7 +363,7 @@
364 def test_execution(client):363 def test_execution(client):
365 """Actual test."""364 """Actual test."""
366 self.root.register_user(app_name, email, password, displayname,365 self.root.register_user(app_name, email, password, displayname,
367 captcha_id, captcha_solution, blocking,366 captcha_id, captcha_solution,
368 self.login.emit_user_registered,367 self.login.emit_user_registered,
369 self.login.emit_user_registration_error)368 self.login.emit_user_registration_error)
370 self.mocker.replay()369 self.mocker.replay()
@@ -453,7 +452,7 @@
453 @defer.inlineCallbacks452 @defer.inlineCallbacks
454 def test_execution(client):453 def test_execution(client):
455 """Actual test."""454 """Actual test."""
456 self.root.login(app_name, email, password, blocking,455 self.root.login(app_name, email, password,
457 self.login.emit_logged_in,456 self.login.emit_logged_in,
458 self.login.emit_login_error,457 self.login.emit_login_error,
459 self.login.emit_user_not_validated)458 self.login.emit_user_not_validated)
@@ -524,7 +523,7 @@
524 def test_execution(client):523 def test_execution(client):
525 """Actual test."""524 """Actual test."""
526 self.root.validate_email(app_name, email, password, email_token,525 self.root.validate_email(app_name, email, password, email_token,
527 blocking, self.login.emit_email_validated,526 self.login.emit_email_validated,
528 self.login.emit_email_validation_error)527 self.login.emit_email_validation_error)
529 self.mocker.replay()528 self.mocker.replay()
530 yield client.validate_email(app_name, email, password, email_token)529 yield client.validate_email(app_name, email, password, email_token)
@@ -590,7 +589,7 @@
590 @defer.inlineCallbacks589 @defer.inlineCallbacks
591 def test_execution(client):590 def test_execution(client):
592 """Actual test."""591 """Actual test."""
593 self.root.request_password_reset_token(app_name, email, blocking,592 self.root.request_password_reset_token(app_name, email,
594 self.login.emit_password_reset_token_sent,593 self.login.emit_password_reset_token_sent,
595 self.login.emit_password_reset_error)594 self.login.emit_password_reset_error)
596 self.mocker.replay()595 self.mocker.replay()
@@ -660,7 +659,7 @@
660 def test_execution(client):659 def test_execution(client):
661 """Actual test."""660 """Actual test."""
662 self.root.set_new_password(app_name, email, token, new_password,661 self.root.set_new_password(app_name, email, token, new_password,
663 blocking, self.login.emit_password_changed,662 self.login.emit_password_changed,
664 self.login.emit_password_change_error)663 self.login.emit_password_change_error)
665 self.mocker.replay()664 self.mocker.replay()
666 yield client.set_new_password(app_name, email, token, new_password)665 yield client.set_new_password(app_name, email, token, new_password)
667666
=== modified file 'ubuntu_sso/main/windows.py'
--- ubuntu_sso/main/windows.py 2011-07-16 04:14:45 +0000
+++ ubuntu_sso/main/windows.py 2011-07-26 15:38:26 +0000
@@ -177,7 +177,7 @@
177177
178 def generate_captcha(self, app_name, filename):178 def generate_captcha(self, app_name, filename):
179 """Call the matching method in the processor."""179 """Call the matching method in the processor."""
180 self.root.generate_captcha(app_name, filename, blocking,180 self.root.generate_captcha(app_name, filename,
181 self.emit_captcha_generated,181 self.emit_captcha_generated,
182 self.emit_captcha_generation_error)182 self.emit_captcha_generation_error)
183183
@@ -199,7 +199,7 @@
199 captcha_id, captcha_solution):199 captcha_id, captcha_solution):
200 """Call the matching method in the processor."""200 """Call the matching method in the processor."""
201 self.root.register_user(app_name, email, password, displayname,201 self.root.register_user(app_name, email, password, displayname,
202 captcha_id, captcha_solution, blocking,202 captcha_id, captcha_solution,
203 self.emit_user_registered,203 self.emit_user_registered,
204 self.emit_user_registration_error)204 self.emit_user_registration_error)
205205
@@ -225,7 +225,7 @@
225225
226 def login(self, app_name, email, password):226 def login(self, app_name, email, password):
227 """Call the matching method in the processor."""227 """Call the matching method in the processor."""
228 self.root.login(app_name, email, password, blocking,228 self.root.login(app_name, email, password,
229 self.emit_logged_in, self.emit_login_error,229 self.emit_logged_in, self.emit_login_error,
230 self.emit_user_not_validated)230 self.emit_user_not_validated)
231231
@@ -246,7 +246,7 @@
246 def validate_email(self, app_name, email, password, email_token):246 def validate_email(self, app_name, email, password, email_token):
247 """Call the matching method in the processor."""247 """Call the matching method in the processor."""
248 self.root.validate_email(app_name, email, password, email_token,248 self.root.validate_email(app_name, email, password, email_token,
249 blocking, self.emit_email_validated,249 self.emit_email_validated,
250 self.emit_email_validation_error)250 self.emit_email_validation_error)
251251
252 # request_password_reset_token signals252 # request_password_reset_token signals
@@ -265,7 +265,7 @@
265265
266 def request_password_reset_token(self, app_name, email):266 def request_password_reset_token(self, app_name, email):
267 """Call the matching method in the processor."""267 """Call the matching method in the processor."""
268 self.root.request_password_reset_token(app_name, email, blocking,268 self.root.request_password_reset_token(app_name, email,
269 self.emit_password_reset_token_sent,269 self.emit_password_reset_token_sent,
270 self.emit_password_reset_error)270 self.emit_password_reset_error)
271271
@@ -286,7 +286,7 @@
286 def set_new_password(self, app_name, email, token, new_password):286 def set_new_password(self, app_name, email, token, new_password):
287 """Call the matching method in the processor."""287 """Call the matching method in the processor."""
288 self.root.set_new_password(app_name, email, token, new_password,288 self.root.set_new_password(app_name, email, token, new_password,
289 blocking, self.emit_password_changed,289 self.emit_password_changed,
290 self.emit_password_change_error)290 self.emit_password_change_error)
291291
292292
293293
=== modified file 'ubuntu_sso/networkstate/windows.py'
--- ubuntu_sso/networkstate/windows.py 2011-07-25 14:45:33 +0000
+++ ubuntu_sso/networkstate/windows.py 2011-07-26 15:38:26 +0000
@@ -102,8 +102,7 @@
102102
103 def __init__(self, connected_cb=None, connected_cb_info=None,103 def __init__(self, connected_cb=None, connected_cb_info=None,
104 disconnected_cb=None):104 disconnected_cb=None):
105 # pylint: disable=E1101,E1120105 # pylint: disable=E1101,E1120,W0231
106 DesignatedWrapPolicy.__init__(self)
107 self._wrap_(self)106 self._wrap_(self)
108 # pylint: enable=E1101,E1120107 # pylint: enable=E1101,E1120
109 self.connected_cb = connected_cb108 self.connected_cb = connected_cb

Subscribers

People subscribed via source and target branches