← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/remove-precise-hacks into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-precise-hacks into lp:launchpad.

Commit message:
Drop compatibility with Ubuntu < 16.04, simplifying some code.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-precise-hacks/+merge/332892
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-precise-hacks into lp:launchpad.
=== modified file 'lib/lp/services/features/scopes.py'
--- lib/lp/services/features/scopes.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/features/scopes.py	2017-10-27 07:39:01 +0000
@@ -23,6 +23,7 @@
 
 __metaclass__ = type
 
+from itertools import izip_longest
 import re
 
 from lp.registry.interfaces.person import IPerson
@@ -86,11 +87,9 @@
         pageid_scope = scope_name[len('pageid:'):]
         scope_segments = self._pageid_to_namespace(pageid_scope)
         request_segments = self._request_pageid_namespace
-        # In 2.6, this can be replaced with izip_longest
-        for pos, name in enumerate(scope_segments):
-            if pos == len(request_segments):
-                return False
-            if request_segments[pos] != name:
+        for scope_segment, request_segment in izip_longest(
+                scope_segments, request_segments):
+            if scope_segment != request_segment:
                 return False
         return True
 

=== modified file 'lib/lp/services/salesforce/proxy.py'
--- lib/lp/services/salesforce/proxy.py	2017-05-05 11:48:31 +0000
+++ lib/lp/services/salesforce/proxy.py	2017-10-27 07:39:01 +0000
@@ -93,15 +93,12 @@
     def __init__(self):
         # XXX cjwatson 2017-05-05: The proxy currently only has a
         # self-signed certificate.  Until that's fixed, don't bother
-        # checking it.  This can be simplified once everything is on Python
-        # >= 2.7.9 so that ssl.SSLContext is always available.
-        kwargs = {}
-        if hasattr(ssl, "SSLContext"):
-            context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
-            context.options |= ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3
-            kwargs["context"] = context
+        # checking it.
+        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+        context.options |= ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3
         self.xmlrpc_transport = SafeTransportWithTimeout(
-            timeout=config.commercial.voucher_proxy_timeout / 1000.0, **kwargs)
+            timeout=config.commercial.voucher_proxy_timeout / 1000.0,
+            context=context)
 
     @cachedproperty
     def url(self):

=== modified file 'lib/lp/services/webapp/openid.py'
--- lib/lp/services/webapp/openid.py	2017-01-26 17:13:16 +0000
+++ lib/lp/services/webapp/openid.py	2017-10-27 07:39:01 +0000
@@ -12,7 +12,6 @@
     ]
 
 from functools import partial
-import inspect
 import os.path
 import urllib2
 
@@ -28,10 +27,7 @@
     # Make sure we're using the same fetcher that we use in production, even
     # if pycurl is installed.
     fetcher = Urllib2Fetcher()
-    # XXX cjwatson 2017-01-26: Remove inspect hack once we no longer need to
-    # run on Ubuntu 12.04 LTS.
-    if (config.launchpad.enable_test_openid_provider and
-            "cafile" in inspect.getargspec(urllib2.urlopen).args):
+    if config.launchpad.enable_test_openid_provider:
         cafile = os.path.join(config.root, "configs/development/launchpad.crt")
         fetcher.urlopen = partial(urllib2.urlopen, cafile=cafile)
     setDefaultFetcher(fetcher)


Follow ups