Rev 4782: Fixed as per review comments. in file:///home/vila/src/bzr/bugs/186920-lp-proxy/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Oct 30 21:02:37 GMT 2009


At file:///home/vila/src/bzr/bugs/186920-lp-proxy/

------------------------------------------------------------
revno: 4782
revision-id: v.ladeuil+lp at free.fr-20091030210237-y3va20lmppu1nbzp
parent: v.ladeuil+lp at free.fr-20091030180208-t5utkcy3elich3zo
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 186920-lp-proxy
timestamp: Fri 2009-10-30 22:02:37 +0100
message:
  Fixed as per review comments.
  
  * bzrlib/transport/http/_urllib2_wrappers.py:
  (Request.set_proxy): No need to test sef.port, it's never set anyway.
  
  * bzrlib/plugins/launchpad/lp_registration.py:
  (XMLRPCTransport): Renamed from Transport to avoid too much
  confusion.
-------------- next part --------------
=== modified file 'bzrlib/plugins/launchpad/lp_registration.py'
--- a/bzrlib/plugins/launchpad/lp_registration.py	2009-10-30 15:41:57 +0000
+++ b/bzrlib/plugins/launchpad/lp_registration.py	2009-10-30 21:02:37 +0000
@@ -54,7 +54,7 @@
         errors.BzrError.__init__(self, url=url)
 
 
-class Transport(xmlrpclib.Transport):
+class XMLRPCTransport(xmlrpclib.Transport):
 
     def __init__(self, scheme, use_datetime=0):
         xmlrpclib.Transport.__init__(self, use_datetime=use_datetime)
@@ -114,7 +114,7 @@
         self._lp_instance = lp_instance
         if transport is None:
             uri_type = urllib.splittype(self.service_url)[0]
-            transport = Transport(uri_type)
+            transport = XMLRPCTransport(uri_type)
             transport.user_agent = 'bzr/%s (xmlrpclib/%s)' \
                     % (_bzrlib_version, xmlrpclib.__version__)
         self.transport = transport

=== modified file 'bzrlib/plugins/launchpad/test_lp_directory.py'
--- a/bzrlib/plugins/launchpad/test_lp_directory.py	2009-10-30 15:15:32 +0000
+++ b/bzrlib/plugins/launchpad/test_lp_directory.py	2009-10-30 21:02:37 +0000
@@ -47,7 +47,7 @@
     result = loader.suiteClass()
     t_tests, remaining_tests = tests.split_suite_by_condition(
         standard_tests, tests.condition_isinstance((
-                TestTransport,
+                TestXMLRPCTransport,
                 )))
     transport_scenarios = [
         ('http', dict(server_class=PreCannedHTTPServer,)),
@@ -244,6 +244,7 @@
 
         self.wfile.write(tcs.canned_response)
 
+
 class PreCannedServerMixin(object):
 
     def __init__(self):
@@ -265,7 +266,7 @@
         pass
 
 
-class TestTransport(tests.TestCase):
+class TestXMLRPCTransport(tests.TestCase):
 
     # set by load_tests
     server_class = None

=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py	2009-10-30 18:02:08 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py	2009-10-30 21:02:37 +0000
@@ -366,17 +366,13 @@
 
     def set_proxy(self, proxy, type):
         """Set the proxy and remember the proxied host."""
-        if self.port is None:
-            # We need to set the default port ourselves way before it gets set
-            # by the HTTPConnection build time.
-            if self.type == 'https':
-                conn_class = HTTPSConnection
-            else:
-                conn_class = HTTPConnection
-            port = conn_class.default_port
+        # We need to set the default port ourselves way before it gets set
+        # in the HTTP[S]Connection object at build time.
+        if self.type == 'https':
+            conn_class = HTTPSConnection
         else:
-            port = self.port
-        self.proxied_host = '%s:%s' % (self.get_host(), port)
+            conn_class = HTTPConnection
+        self.proxied_host = '%s:%s' % (self.get_host(), conn_class.default_port)
         urllib2.Request.set_proxy(self, proxy, type)
 
 



More information about the bazaar-commits mailing list