diff options
| author | Petr Viktorin <pviktori@redhat.com> | 2015-09-14 14:03:58 +0200 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2015-10-07 10:27:20 +0200 |
| commit | 026b1b5307939e6a75ec4866e21cd420733370cb (patch) | |
| tree | 150bb169b1d71bfb9167c79e56fc8efeed5bc811 /ipapython | |
| parent | 187efdfe42e039d6c7e39bab00a1d22751c393e6 (diff) | |
| download | freeipa-026b1b5307939e6a75ec4866e21cd420733370cb.tar.gz freeipa-026b1b5307939e6a75ec4866e21cd420733370cb.tar.xz freeipa-026b1b5307939e6a75ec4866e21cd420733370cb.zip | |
Use six.moves.http_client instead of httplib
The module was renamed in Python 3.
Reviewed-By: David Kupka <dkupka@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'ipapython')
| -rw-r--r-- | ipapython/dogtag.py | 8 | ||||
| -rw-r--r-- | ipapython/nsslib.py | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py index bad8039f2..51c2ec9b4 100644 --- a/ipapython/dogtag.py +++ b/ipapython/dogtag.py @@ -19,7 +19,6 @@ import collections import os -import httplib import xml.dom.minidom import nss.nss as nss @@ -34,6 +33,13 @@ from ipapython import nsslib, ipautil from ipaplatform.paths import paths from ipapython.ipa_log_manager import * +# Python 3 rename. The package is available in "six.moves.http_client", but +# pylint cannot handle classes from that alias +try: + import httplib +except ImportError: + import http.client as httplib + if six.PY3: unicode = str diff --git a/ipapython/nsslib.py b/ipapython/nsslib.py index fbe607506..0d02e768b 100644 --- a/ipapython/nsslib.py +++ b/ipapython/nsslib.py @@ -21,7 +21,6 @@ from __future__ import print_function import sys -import httplib import getpass import socket from ipapython.ipa_log_manager import * @@ -31,6 +30,14 @@ import nss.io as io import nss.nss as nss import nss.ssl as ssl import nss.error as error + +# Python 3 rename. The package is available in "six.moves.http_client", but +# pylint cannot handle classes from that alias +try: + import httplib +except ImportError: + import http.client as httplib + from ipaplatform.paths import paths # NSS database currently open @@ -295,6 +302,7 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback): self.close() raise e + class NSSHTTPS(httplib.HTTP): # We would like to use HTTP 1.1 not the older HTTP 1.0 but xmlrpc.client # and httplib do not play well together. httplib when the protocol |
