Replace usage of urllib in nova rest api

urllib is incompatible for python 3.

Change-Id: I3d70cd3f77a946afd4e873823edfdc5bd0e07a16
This commit is contained in:
lin-hua-cheng 2015-03-16 09:56:34 -07:00
parent 20ef6b4acc
commit 4475225cbe

View File

@ -15,8 +15,7 @@
"""API over the nova service. """API over the nova service.
""" """
import urllib from django.utils import http as utils_http
from django.views import generic from django.views import generic
from openstack_dashboard import api from openstack_dashboard import api
@ -58,7 +57,7 @@ class Keypairs(generic.View):
else: else:
new = api.nova.keypair_create(request, request.DATA['name']) new = api.nova.keypair_create(request, request.DATA['name'])
return rest_utils.CreatedResponse( return rest_utils.CreatedResponse(
'/api/nova/keypairs/%s' % urllib.quote(new.name), '/api/nova/keypairs/%s' % utils_http.urlquote(new.name),
new.to_dict() new.to_dict()
) )
@ -170,7 +169,7 @@ class Servers(generic.View):
new = api.nova.server_create(*args, **kw) new = api.nova.server_create(*args, **kw)
return rest_utils.CreatedResponse( return rest_utils.CreatedResponse(
'/api/nova/servers/%s' % urllib.quote(new.id), '/api/nova/servers/%s' % utils_http.urlquote(new.id),
new.to_dict() new.to_dict()
) )