Skip to content

Commit 7db976c

Browse files
committed
Fix typos in ssladapter.py
- Check that `urllib_ver` is not None, instead of `urllib3` - Do version comparison only if `urllib_ver` is *not* "dev" Fixes #325. Original work by @sidprak.
1 parent 7a46297 commit 7db976c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docker/ssladapter/ssladapter.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ def __init__(self, ssl_version=None, **kwargs):
2020
super(SSLAdapter, self).__init__(**kwargs)
2121

2222
def init_poolmanager(self, connections, maxsize, block=False):
23-
urllib_ver = urllib3.__version__.split('-')[0]
2423
kwargs = {
2524
'num_pools': connections,
2625
'maxsize': maxsize,
2726
'block': block
2827
}
29-
if urllib3 and urllib_ver == 'dev' and \
30-
StrictVersion(urllib_ver) > StrictVersion('1.5'):
28+
if self.can_override_ssl_version():
3129
kwargs['ssl_version'] = self.ssl_version
3230

3331
self.poolmanager = PoolManager(**kwargs)
32+
33+
def can_override_ssl_version(self):
34+
urllib_ver = urllib3.__version__.split('-')[0]
35+
if urllib_ver is None:
36+
return False
37+
if urllib_ver == 'dev':
38+
return True
39+
return StrictVersion(urllib_ver) > StrictVersion('1.5')

0 commit comments

Comments
 (0)