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

Proposed by Colin Watson
Status: Merged
Merged at revision: 18495
Proposed branch: lp:~cjwatson/launchpad/remove-precise-hacks
Merge into: lp:launchpad
Diff against target: 75 lines (+10/-18)
3 files modified
lib/lp/services/features/scopes.py (+4/-5)
lib/lp/services/salesforce/proxy.py (+5/-8)
lib/lp/services/webapp/openid.py (+1/-5)
To merge this branch: bzr merge lp:~cjwatson/launchpad/remove-precise-hacks
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+332892@code.launchpad.net

Commit message

Drop compatibility with Ubuntu < 16.04, simplifying some code.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/features/scopes.py'
2--- lib/lp/services/features/scopes.py 2012-01-01 02:58:52 +0000
3+++ lib/lp/services/features/scopes.py 2017-10-27 07:39:01 +0000
4@@ -23,6 +23,7 @@
5
6 __metaclass__ = type
7
8+from itertools import izip_longest
9 import re
10
11 from lp.registry.interfaces.person import IPerson
12@@ -86,11 +87,9 @@
13 pageid_scope = scope_name[len('pageid:'):]
14 scope_segments = self._pageid_to_namespace(pageid_scope)
15 request_segments = self._request_pageid_namespace
16- # In 2.6, this can be replaced with izip_longest
17- for pos, name in enumerate(scope_segments):
18- if pos == len(request_segments):
19- return False
20- if request_segments[pos] != name:
21+ for scope_segment, request_segment in izip_longest(
22+ scope_segments, request_segments):
23+ if scope_segment != request_segment:
24 return False
25 return True
26
27
28=== modified file 'lib/lp/services/salesforce/proxy.py'
29--- lib/lp/services/salesforce/proxy.py 2017-05-05 11:48:31 +0000
30+++ lib/lp/services/salesforce/proxy.py 2017-10-27 07:39:01 +0000
31@@ -93,15 +93,12 @@
32 def __init__(self):
33 # XXX cjwatson 2017-05-05: The proxy currently only has a
34 # self-signed certificate. Until that's fixed, don't bother
35- # checking it. This can be simplified once everything is on Python
36- # >= 2.7.9 so that ssl.SSLContext is always available.
37- kwargs = {}
38- if hasattr(ssl, "SSLContext"):
39- context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
40- context.options |= ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3
41- kwargs["context"] = context
42+ # checking it.
43+ context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
44+ context.options |= ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3
45 self.xmlrpc_transport = SafeTransportWithTimeout(
46- timeout=config.commercial.voucher_proxy_timeout / 1000.0, **kwargs)
47+ timeout=config.commercial.voucher_proxy_timeout / 1000.0,
48+ context=context)
49
50 @cachedproperty
51 def url(self):
52
53=== modified file 'lib/lp/services/webapp/openid.py'
54--- lib/lp/services/webapp/openid.py 2017-01-26 17:13:16 +0000
55+++ lib/lp/services/webapp/openid.py 2017-10-27 07:39:01 +0000
56@@ -12,7 +12,6 @@
57 ]
58
59 from functools import partial
60-import inspect
61 import os.path
62 import urllib2
63
64@@ -28,10 +27,7 @@
65 # Make sure we're using the same fetcher that we use in production, even
66 # if pycurl is installed.
67 fetcher = Urllib2Fetcher()
68- # XXX cjwatson 2017-01-26: Remove inspect hack once we no longer need to
69- # run on Ubuntu 12.04 LTS.
70- if (config.launchpad.enable_test_openid_provider and
71- "cafile" in inspect.getargspec(urllib2.urlopen).args):
72+ if config.launchpad.enable_test_openid_provider:
73 cafile = os.path.join(config.root, "configs/development/launchpad.crt")
74 fetcher.urlopen = partial(urllib2.urlopen, cafile=cafile)
75 setDefaultFetcher(fetcher)