Merge lp:~brian.curtin/ubuntu-sso-client/nam-setproxy-windows-workaround into lp:ubuntu-sso-client

Proposed by Brian Curtin on 2012-10-19
Status: Merged
Approved by: Brian Curtin on 2012-10-24
Approved revision: 1009
Merged at revision: 1009
Proposed branch: lp:~brian.curtin/ubuntu-sso-client/nam-setproxy-windows-workaround
Merge into: lp:ubuntu-sso-client
Diff against target: 29 lines (+7/-2)
2 files modified
ubuntu_sso/utils/webclient/qtnetwork.py (+3/-2)
ubuntu_sso/utils/webclient/tests/test_qtnetwork.py (+4/-0)
To merge this branch: bzr merge lp:~brian.curtin/ubuntu-sso-client/nam-setproxy-windows-workaround
Reviewer Review Type Date Requested Status
Michał Karnicki (community) Approve on 2012-10-24
dobey (community) 2012-10-19 Approve on 2012-10-20
Review via email: mp+130626@code.launchpad.net

Commit Message

- Only call QNetworkAccessManager.setProxy on Linux, as this method is broken on Windows.

Description of the Change

rev 1008 made a change that broke Windows and Mac while trying to work with the version of PyQt available in Quantal. The added "self.nam.setProxy" call does not work on either platform, so this branch only calls that on linux, and adds a check to see that it's not called when it's not supposed to be.

This appears to be a bug in PyQt, as the setProxy method is given the proper object but receives a TypeError on Mac/Windows that the first argument isn't a QNetworkAccessManager (should be QNetworkProxy).

To post a comment you must log in.
dobey (dobey) :
review: Approve
Michał Karnicki (karni) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/utils/webclient/qtnetwork.py'
2--- ubuntu_sso/utils/webclient/qtnetwork.py 2012-10-04 10:53:51 +0000
3+++ ubuntu_sso/utils/webclient/qtnetwork.py 2012-10-19 19:47:19 +0000
4@@ -107,8 +107,9 @@
5 def _set_proxy(self, proxy):
6 """Set the proxy to be used."""
7 QNetworkProxy.setApplicationProxy(proxy)
8- # ensure that we work with the latest qt in ubuntu q
9- self.nam.setProxy(proxy)
10+ if sys.platform.startswith("linux"):
11+ # ensure that we work with the latest qt in ubuntu q
12+ self.nam.setProxy(proxy)
13
14 def setup_proxy(self):
15 """Setup the proxy settings if needed."""
16
17=== modified file 'ubuntu_sso/utils/webclient/tests/test_qtnetwork.py'
18--- ubuntu_sso/utils/webclient/tests/test_qtnetwork.py 2012-10-04 12:30:38 +0000
19+++ ubuntu_sso/utils/webclient/tests/test_qtnetwork.py 2012-10-19 19:47:19 +0000
20@@ -163,6 +163,10 @@
21 """Test setting the proxy."""
22 qtnetwork.WebClient()
23 self.assertEqual(self.proxy, qtnetwork.WebClient.proxy_instance)
24+ # nam.setProxy does not work on Windows (PyQt 4.9.4)
25+ # so WebClient._set_proxy was changed to not call setProxy
26+ # like we do on Quantal.
27+ self.assertNotIn(('setProxy', self.proxy), self.called)
28 self.assertIn(('systemProxyForQuery', self.query), self.called)
29 self.assertIn(('setApplicationProxy', self.proxy), self.called)
30

Subscribers

People subscribed via source and target branches