Replace urllib with six.moves.urllib for py3 support
This patch does the following for py3 support: 1. replace httplib with six.moves.http_client 2. replace func.func_name with func.__name__ 3. replace urllib with six.moves.urllib Change-Id: Ic18934b47da7844506482b29a3ecb2a36b3ce33f Partially-Implements: blueprint barbican-py3
This commit is contained in:
parent
83d36f4641
commit
cad8e637fb
@ -12,9 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib
|
||||
|
||||
import pecan
|
||||
from six.moves.urllib import parse
|
||||
|
||||
from barbican.api import controllers
|
||||
from barbican.common import hrefs
|
||||
@ -260,11 +259,11 @@ class CertificateAuthoritiesController(controllers.ACLMixin):
|
||||
|
||||
plugin_name = kw.get('plugin_name')
|
||||
if plugin_name is not None:
|
||||
plugin_name = urllib.unquote_plus(plugin_name)
|
||||
plugin_name = parse.unquote_plus(plugin_name)
|
||||
|
||||
plugin_ca_id = kw.get('plugin_ca_id', None)
|
||||
if plugin_ca_id is not None:
|
||||
plugin_ca_id = urllib.unquote_plus(plugin_ca_id)
|
||||
plugin_ca_id = parse.unquote_plus(plugin_ca_id)
|
||||
|
||||
result = self.ca_repo.get_by_create_date(
|
||||
offset_arg=kw.get('offset', 0),
|
||||
|
@ -10,9 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib
|
||||
|
||||
import pecan
|
||||
from six.moves.urllib import parse
|
||||
|
||||
from barbican import api
|
||||
from barbican.api import controllers
|
||||
@ -259,7 +258,7 @@ class SecretsController(controllers.ACLMixin):
|
||||
|
||||
name = kw.get('name', '')
|
||||
if name:
|
||||
name = urllib.unquote_plus(name)
|
||||
name = parse.unquote_plus(name)
|
||||
|
||||
bits = kw.get('bits', 0)
|
||||
try:
|
||||
|
@ -12,9 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib
|
||||
|
||||
import pecan
|
||||
from six.moves.urllib import parse
|
||||
|
||||
from barbican import api
|
||||
from barbican.api import controllers
|
||||
@ -98,7 +97,7 @@ class TransportKeysController(controllers.ACLMixin):
|
||||
|
||||
plugin_name = kw.get('plugin_name', None)
|
||||
if plugin_name is not None:
|
||||
plugin_name = urllib.unquote_plus(plugin_name)
|
||||
plugin_name = parse.unquote_plus(plugin_name)
|
||||
|
||||
result = self.repo.get_by_create_date(
|
||||
plugin_name=plugin_name,
|
||||
|
@ -260,7 +260,7 @@ def wrap_db_error(f):
|
||||
raise
|
||||
except sqlalchemy.exc.DBAPIError:
|
||||
raise
|
||||
_wrap.func_name = f.func_name
|
||||
_wrap.__name__ = f.__name__
|
||||
return _wrap
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import httplib
|
||||
from six.moves import http_client
|
||||
|
||||
|
||||
host = "localhost"
|
||||
@ -47,7 +47,7 @@ def get_demo_token(password):
|
||||
|
||||
def ping_barbican(token_id):
|
||||
headers = {'X_AUTH_TOKEN': token_id, 'X_IDENTITY_STATUS': 'Confirmed'}
|
||||
connection = httplib.HTTPConnection(host, port, timeout=timeout)
|
||||
connection = http_client.HTTPConnection(host, port, timeout=timeout)
|
||||
connection.request(method, path, None, headers)
|
||||
response = connection.getresponse().read()
|
||||
connection.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user