ipapython.nsslib, ipalib.rpc: Remove code for Python 2.6 and below

IPA hasn't supported these pythons for a while now.

Reviewed-By: Tomas Babej <tbabej@redhat.com>
This commit is contained in:
Petr Viktorin 2015-10-20 19:01:23 +02:00 committed by Tomas Babej
parent beb6a3236d
commit 4ddd1821b6
2 changed files with 13 additions and 28 deletions

View File

@ -480,10 +480,7 @@ class SSLTransport(LanguageAwareTransport):
def make_connection(self, host):
host, self._extra_headers, x509 = self.get_host_info(host)
# Python 2.7 changed the internal class used in xmlrpclib from
# HTTP to HTTPConnection. We need to use the proper subclass
if sys.version_info >= (2, 7):
if self._connection and host == self._connection[0]:
return self._connection[1]
@ -500,18 +497,13 @@ class SSLTransport(LanguageAwareTransport):
# need to re-initialize.
no_init = dbdir == ipapython.nsslib.current_dbdir
if sys.version_info < (2, 7):
conn = NSSHTTPS(host, 443, dbdir=dbdir, no_init=no_init)
else:
conn = NSSConnection(host, 443, dbdir=dbdir, no_init=no_init,
tls_version_min=api.env.tls_version_min,
tls_version_max=api.env.tls_version_max)
self.dbdir=dbdir
conn.connect()
if sys.version_info < (2, 7):
return conn
else:
self._connection = host, conn
return self._connection[1]
@ -925,7 +917,6 @@ class RPCClient(Connectible):
return serverproxy
def destroy_connection(self):
if sys.version_info >= (2, 7):
conn = getattr(context, self.id, None)
if conn is not None:
conn = conn.conn._ServerProxy__transport

View File

@ -291,12 +291,6 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
"""
try:
# FIXME: httplib uses old-style classes so super doesn't work
# Python 2.7 changed the API for endheaders. This is an attempt
# to work across versions
(major, minor, micro, releaselevel, serial) = sys.version_info
if major == 2 and minor < 7:
httplib.HTTPConnection.endheaders(self)
else:
httplib.HTTPConnection.endheaders(self, message)
except NSPRError as e:
self.close()