Merge lp:~ralsina/ubuntu-sso-client/no-thread-execute into lp:ubuntu-sso-client
- no-thread-execute
- Merge into trunk
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 |
Related bugs: |
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
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ubuntu_sso/main/__init__.py' |
2 | --- ubuntu_sso/main/__init__.py 2011-07-14 18:58:00 +0000 |
3 | +++ ubuntu_sso/main/__init__.py 2011-07-26 15:38:26 +0000 |
4 | @@ -75,7 +75,7 @@ |
5 | self.processor = self.sso_login_processor_class( |
6 | sso_service_class=sso_service_class) |
7 | |
8 | - def generate_captcha(self, app_name, filename, thread_execute, result_cb, |
9 | + def generate_captcha(self, app_name, filename, result_cb, |
10 | error_cb): |
11 | """Call the matching method in the processor.""" |
12 | def f(): |
13 | @@ -84,7 +84,7 @@ |
14 | thread_execute(f, app_name, result_cb, error_cb) |
15 | |
16 | def register_user(self, app_name, email, password, name, captcha_id, |
17 | - captcha_solution, thread_execute, result_cb, error_cb): |
18 | + captcha_solution, result_cb, error_cb): |
19 | """Call the matching method in the processor.""" |
20 | def f(): |
21 | """Inner function that will be run in a thread.""" |
22 | @@ -92,7 +92,7 @@ |
23 | captcha_id, captcha_solution) |
24 | thread_execute(f, app_name, result_cb, error_cb) |
25 | |
26 | - def login(self, app_name, email, password, thread_execute, result_cb, |
27 | + def login(self, app_name, email, password, result_cb, |
28 | error_cb, not_validated_cb): |
29 | """Call the matching method in the processor.""" |
30 | def f(): |
31 | @@ -121,7 +121,7 @@ |
32 | thread_execute(f, app_name, success_cb, error_cb) |
33 | |
34 | def validate_email(self, app_name, email, password, email_token, |
35 | - thread_execute, result_cb, error_cb): |
36 | + result_cb, error_cb): |
37 | """Call the matching method in the processor.""" |
38 | |
39 | def f(): |
40 | @@ -141,7 +141,7 @@ |
41 | |
42 | thread_execute(f, app_name, success_cb, error_cb) |
43 | |
44 | - def request_password_reset_token(self, app_name, email, thread_execute, |
45 | + def request_password_reset_token(self, app_name, email, |
46 | result_cb, error_cb): |
47 | """Call the matching method in the processor.""" |
48 | def f(): |
49 | @@ -150,7 +150,7 @@ |
50 | thread_execute(f, app_name, result_cb, error_cb) |
51 | |
52 | def set_new_password(self, app_name, email, token, new_password, |
53 | - thread_execute, result_cb, error_cb): |
54 | + result_cb, error_cb): |
55 | """Call the matching method in the processor.""" |
56 | def f(): |
57 | """Inner function that will be run in a thread.""" |
58 | @@ -410,8 +410,10 @@ |
59 | SSOCredentials = windows.SSOCredentials |
60 | CredentialsManagement = windows.CredentialsManagement |
61 | TIMEOUT_INTERVAL = 10000000000 # forever |
62 | + thread_execute = windows.blocking |
63 | else: |
64 | from ubuntu_sso.main import linux |
65 | SSOLogin = linux.SSOLogin |
66 | SSOCredentials = linux.SSOCredentials |
67 | CredentialsManagement = linux.CredentialsManagement |
68 | + thread_execute = linux.blocking |
69 | |
70 | === modified file 'ubuntu_sso/main/linux.py' |
71 | --- ubuntu_sso/main/linux.py 2011-04-25 18:41:34 +0000 |
72 | +++ ubuntu_sso/main/linux.py 2011-07-26 15:38:26 +0000 |
73 | @@ -92,7 +92,7 @@ |
74 | in_signature='ss') |
75 | def generate_captcha(self, app_name, filename): |
76 | """Call the matching method in the processor.""" |
77 | - self.root.generate_captcha(app_name, filename, blocking, |
78 | + self.root.generate_captcha(app_name, filename, |
79 | self.CaptchaGenerated, |
80 | self.CaptchaGenerationError) |
81 | |
82 | @@ -115,7 +115,7 @@ |
83 | captcha_id, captcha_solution): |
84 | """Call the matching method in the processor.""" |
85 | self.root.register_user(app_name, email, password, name, captcha_id, |
86 | - captcha_solution, blocking, |
87 | + captcha_solution, |
88 | self.UserRegistered, |
89 | self.UserRegistrationError) |
90 | |
91 | @@ -142,7 +142,7 @@ |
92 | in_signature='sss') |
93 | def login(self, app_name, email, password): |
94 | """Call the matching method in the processor.""" |
95 | - self.root.login(app_name, email, password, blocking, self.LoggedIn, |
96 | + self.root.login(app_name, email, password, self.LoggedIn, |
97 | self.LoginError, self.UserNotValidated) |
98 | |
99 | # validate_email signals |
100 | @@ -163,7 +163,7 @@ |
101 | def validate_email(self, app_name, email, password, email_token): |
102 | """Call the matching method in the processor.""" |
103 | self.root.validate_email(app_name, email, password, email_token, |
104 | - blocking, self.EmailValidated, |
105 | + self.EmailValidated, |
106 | self.EmailValidationError) |
107 | |
108 | # request_password_reset_token signals |
109 | @@ -183,7 +183,7 @@ |
110 | in_signature='ss') |
111 | def request_password_reset_token(self, app_name, email): |
112 | """Call the matching method in the processor.""" |
113 | - self.root.request_password_reset_token(app_name, email, blocking, |
114 | + self.root.request_password_reset_token(app_name, email, |
115 | self.PasswordResetTokenSent, |
116 | self.PasswordResetError) |
117 | |
118 | @@ -205,7 +205,7 @@ |
119 | def set_new_password(self, app_name, email, token, new_password): |
120 | """Call the matching method in the processor.""" |
121 | self.root.set_new_password(app_name, email, token, new_password, |
122 | - blocking, self.PasswordChanged, |
123 | + self.PasswordChanged, |
124 | self.PasswordChangeError) |
125 | |
126 | |
127 | |
128 | === modified file 'ubuntu_sso/main/tests/test_common.py' |
129 | --- ubuntu_sso/main/tests/test_common.py 2011-03-31 09:33:48 +0000 |
130 | +++ ubuntu_sso/main/tests/test_common.py 2011-07-26 15:38:26 +0000 |
131 | @@ -75,7 +75,7 @@ |
132 | """Test that the call is relayed.""" |
133 | app_name = 'app' |
134 | filename = 'file' |
135 | - self.root.generate_captcha(app_name, filename, MATCH(callable), |
136 | + self.root.generate_captcha(app_name, filename, |
137 | MATCH(callable), MATCH(callable)) |
138 | self.mocker.replay() |
139 | self.login.generate_captcha(app_name, filename) |
140 | @@ -89,7 +89,7 @@ |
141 | captcha_id = 'id' |
142 | captcha_solution = 'hello' |
143 | self.root.register_user(app_name, email, password, name, captcha_id, |
144 | - captcha_solution, MATCH(callable), |
145 | + captcha_solution, |
146 | MATCH(callable), MATCH(callable)) |
147 | self.mocker.replay() |
148 | self.login.register_user(app_name, email, password, name, captcha_id, |
149 | @@ -100,7 +100,7 @@ |
150 | app_name = 'app' |
151 | email = 'email' |
152 | password = 'password' |
153 | - self.root.login(app_name, email, password, MATCH(callable), |
154 | + self.root.login(app_name, email, password, |
155 | MATCH(callable), MATCH(callable), |
156 | MATCH(callable)) |
157 | self.mocker.mock() |
158 | @@ -114,18 +114,17 @@ |
159 | password = 'passwrd' |
160 | email_token = 'token' |
161 | self.root.validate_email(app_name, email, password, email_token, |
162 | - MATCH(callable), MATCH(callable), |
163 | + MATCH(callable), |
164 | MATCH(callable)) |
165 | self.mocker.replay() |
166 | self.login.validate_email(app_name, email, password, email_token) |
167 | |
168 | - def test_request_password_reset_tolen(self): |
169 | + def test_request_password_reset_token(self): |
170 | """Test that the call is relayed.""" |
171 | app_name = 'app' |
172 | email = 'email' |
173 | self.root.request_password_reset_token(app_name, email, |
174 | MATCH(callable), |
175 | - MATCH(callable), |
176 | MATCH(callable)) |
177 | self.mocker.replay() |
178 | self.login.request_password_reset_token(app_name, email) |
179 | @@ -137,7 +136,7 @@ |
180 | token = 'token' |
181 | new_password = 'new' |
182 | self.root.set_new_password(app_name, email, token, new_password, |
183 | - MATCH(callable), MATCH(callable), |
184 | + MATCH(callable), |
185 | MATCH(callable)) |
186 | self.mocker.replay() |
187 | self.login.set_new_password(app_name, email, token, new_password) |
188 | |
189 | === modified file 'ubuntu_sso/main/tests/test_linux.py' |
190 | --- ubuntu_sso/main/tests/test_linux.py 2011-03-31 03:52:10 +0000 |
191 | +++ ubuntu_sso/main/tests/test_linux.py 2011-07-26 15:38:26 +0000 |
192 | @@ -144,7 +144,7 @@ |
193 | expected_result = "expected result" |
194 | self.create_mock_processor().generate_captcha(filename) |
195 | self.mocker.result(expected_result) |
196 | - self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking) |
197 | + self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking) |
198 | self.mocker.replay() |
199 | |
200 | def verify(app_name, errdict): |
201 | @@ -191,7 +191,7 @@ |
202 | self.create_mock_processor().register_user(EMAIL, PASSWORD, NAME, |
203 | CAPTCHA_ID, CAPTCHA_SOLUTION) |
204 | self.mocker.result(expected_result) |
205 | - self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking) |
206 | + self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking) |
207 | self.mocker.replay() |
208 | |
209 | def verify(app_name, errdict): |
210 | @@ -377,7 +377,7 @@ |
211 | d = Deferred() |
212 | processor = self.create_mock_processor() |
213 | processor.request_password_reset_token(EMAIL) |
214 | - self.patch(ubuntu_sso.main.linux, "blocking", fake_ok_blocking) |
215 | + self.patch(ubuntu_sso.main, "thread_execute", fake_ok_blocking) |
216 | self.mocker.result(EMAIL) |
217 | self.mocker.replay() |
218 | |
219 | @@ -400,7 +400,7 @@ |
220 | |
221 | self.create_mock_processor().request_password_reset_token(EMAIL) |
222 | self.mocker.result(EMAIL) |
223 | - self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking) |
224 | + self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking) |
225 | self.mocker.replay() |
226 | |
227 | def verify(app_name, errdict): |
228 | @@ -446,7 +446,7 @@ |
229 | self.create_mock_processor().set_new_password(EMAIL, EMAIL_TOKEN, |
230 | PASSWORD) |
231 | self.mocker.result(expected_result) |
232 | - self.patch(ubuntu_sso.main.linux, "blocking", fake_err_blocking) |
233 | + self.patch(ubuntu_sso.main, "thread_execute", fake_err_blocking) |
234 | self.mocker.replay() |
235 | |
236 | def verify(app_name, errdict): |
237 | |
238 | === modified file 'ubuntu_sso/main/tests/test_windows.py' |
239 | --- ubuntu_sso/main/tests/test_windows.py 2011-07-13 19:47:18 +0000 |
240 | +++ ubuntu_sso/main/tests/test_windows.py 2011-07-26 15:38:26 +0000 |
241 | @@ -30,7 +30,6 @@ |
242 | ) |
243 | from ubuntu_sso.main import windows |
244 | from ubuntu_sso.main.windows import ( |
245 | - blocking, |
246 | signal, |
247 | CredentialsManagement, |
248 | CredentialsManagementClient, |
249 | @@ -292,7 +291,7 @@ |
250 | @defer.inlineCallbacks |
251 | def test_execution(client): |
252 | """Actual test.""" |
253 | - self.root.generate_captcha(app_name, filename, blocking, |
254 | + self.root.generate_captcha(app_name, filename, |
255 | self.login.emit_captcha_generated, |
256 | self.login.emit_captcha_generation_error) |
257 | self.mocker.replay() |
258 | @@ -364,7 +363,7 @@ |
259 | def test_execution(client): |
260 | """Actual test.""" |
261 | self.root.register_user(app_name, email, password, displayname, |
262 | - captcha_id, captcha_solution, blocking, |
263 | + captcha_id, captcha_solution, |
264 | self.login.emit_user_registered, |
265 | self.login.emit_user_registration_error) |
266 | self.mocker.replay() |
267 | @@ -453,7 +452,7 @@ |
268 | @defer.inlineCallbacks |
269 | def test_execution(client): |
270 | """Actual test.""" |
271 | - self.root.login(app_name, email, password, blocking, |
272 | + self.root.login(app_name, email, password, |
273 | self.login.emit_logged_in, |
274 | self.login.emit_login_error, |
275 | self.login.emit_user_not_validated) |
276 | @@ -524,7 +523,7 @@ |
277 | def test_execution(client): |
278 | """Actual test.""" |
279 | self.root.validate_email(app_name, email, password, email_token, |
280 | - blocking, self.login.emit_email_validated, |
281 | + self.login.emit_email_validated, |
282 | self.login.emit_email_validation_error) |
283 | self.mocker.replay() |
284 | yield client.validate_email(app_name, email, password, email_token) |
285 | @@ -590,7 +589,7 @@ |
286 | @defer.inlineCallbacks |
287 | def test_execution(client): |
288 | """Actual test.""" |
289 | - self.root.request_password_reset_token(app_name, email, blocking, |
290 | + self.root.request_password_reset_token(app_name, email, |
291 | self.login.emit_password_reset_token_sent, |
292 | self.login.emit_password_reset_error) |
293 | self.mocker.replay() |
294 | @@ -660,7 +659,7 @@ |
295 | def test_execution(client): |
296 | """Actual test.""" |
297 | self.root.set_new_password(app_name, email, token, new_password, |
298 | - blocking, self.login.emit_password_changed, |
299 | + self.login.emit_password_changed, |
300 | self.login.emit_password_change_error) |
301 | self.mocker.replay() |
302 | yield client.set_new_password(app_name, email, token, new_password) |
303 | |
304 | === modified file 'ubuntu_sso/main/windows.py' |
305 | --- ubuntu_sso/main/windows.py 2011-07-16 04:14:45 +0000 |
306 | +++ ubuntu_sso/main/windows.py 2011-07-26 15:38:26 +0000 |
307 | @@ -177,7 +177,7 @@ |
308 | |
309 | def generate_captcha(self, app_name, filename): |
310 | """Call the matching method in the processor.""" |
311 | - self.root.generate_captcha(app_name, filename, blocking, |
312 | + self.root.generate_captcha(app_name, filename, |
313 | self.emit_captcha_generated, |
314 | self.emit_captcha_generation_error) |
315 | |
316 | @@ -199,7 +199,7 @@ |
317 | captcha_id, captcha_solution): |
318 | """Call the matching method in the processor.""" |
319 | self.root.register_user(app_name, email, password, displayname, |
320 | - captcha_id, captcha_solution, blocking, |
321 | + captcha_id, captcha_solution, |
322 | self.emit_user_registered, |
323 | self.emit_user_registration_error) |
324 | |
325 | @@ -225,7 +225,7 @@ |
326 | |
327 | def login(self, app_name, email, password): |
328 | """Call the matching method in the processor.""" |
329 | - self.root.login(app_name, email, password, blocking, |
330 | + self.root.login(app_name, email, password, |
331 | self.emit_logged_in, self.emit_login_error, |
332 | self.emit_user_not_validated) |
333 | |
334 | @@ -246,7 +246,7 @@ |
335 | def validate_email(self, app_name, email, password, email_token): |
336 | """Call the matching method in the processor.""" |
337 | self.root.validate_email(app_name, email, password, email_token, |
338 | - blocking, self.emit_email_validated, |
339 | + self.emit_email_validated, |
340 | self.emit_email_validation_error) |
341 | |
342 | # request_password_reset_token signals |
343 | @@ -265,7 +265,7 @@ |
344 | |
345 | def request_password_reset_token(self, app_name, email): |
346 | """Call the matching method in the processor.""" |
347 | - self.root.request_password_reset_token(app_name, email, blocking, |
348 | + self.root.request_password_reset_token(app_name, email, |
349 | self.emit_password_reset_token_sent, |
350 | self.emit_password_reset_error) |
351 | |
352 | @@ -286,7 +286,7 @@ |
353 | def set_new_password(self, app_name, email, token, new_password): |
354 | """Call the matching method in the processor.""" |
355 | self.root.set_new_password(app_name, email, token, new_password, |
356 | - blocking, self.emit_password_changed, |
357 | + self.emit_password_changed, |
358 | self.emit_password_change_error) |
359 | |
360 | |
361 | |
362 | === modified file 'ubuntu_sso/networkstate/windows.py' |
363 | --- ubuntu_sso/networkstate/windows.py 2011-07-25 14:45:33 +0000 |
364 | +++ ubuntu_sso/networkstate/windows.py 2011-07-26 15:38:26 +0000 |
365 | @@ -102,8 +102,7 @@ |
366 | |
367 | def __init__(self, connected_cb=None, connected_cb_info=None, |
368 | disconnected_cb=None): |
369 | - # pylint: disable=E1101,E1120 |
370 | - DesignatedWrapPolicy.__init__(self) |
371 | + # pylint: disable=E1101,E1120,W0231 |
372 | self._wrap_(self) |
373 | # pylint: enable=E1101,E1120 |
374 | self.connected_cb = connected_cb |
Looks fine, thanks!