summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorWilliam Wolf <throughnothing@gmail.com>2011-09-19 11:26:14 -0400
committerWilliam Wolf <throughnothing@gmail.com>2011-09-19 11:26:14 -0400
commit5feb413f7698633c6a598ec2899772269a96b690 (patch)
treecfb25bc23c3756b883ee7c9b6fc0aa0a9d30b8c2 /nova
parent1e094377ada74202bfc4d3c03f6b7f747ad570d7 (diff)
downloadnova-5feb413f7698633c6a598ec2899772269a96b690.tar.gz
nova-5feb413f7698633c6a598ec2899772269a96b690.tar.xz
nova-5feb413f7698633c6a598ec2899772269a96b690.zip
make our own function instead of using urllib.urlencode since we apparently don't suppor urlencoded strings yet
Diffstat (limited to 'nova')
-rw-r--r--nova/api/openstack/common.py10
-rw-r--r--nova/api/openstack/views/servers.py2
-rw-r--r--nova/tests/api/openstack/test_servers.py6
3 files changed, 14 insertions, 4 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py
index ca7848678..64d7dded1 100644
--- a/nova/api/openstack/common.py
+++ b/nova/api/openstack/common.py
@@ -259,6 +259,16 @@ def check_img_metadata_quota_limit(context, metadata):
headers={'Retry-After': 0})
+def dict_to_query_str(params):
+ # TODO: we should just use urllib.urlencode instead of this
+ # But currently we don't work with urlencoded url's
+ param_str = ""
+ for key, val in params.iteritems():
+ param_str = param_str + '='.join([str(key), str(val)]) + '&'
+
+ return param_str.rstrip('&')
+
+
class MetadataXMLDeserializer(wsgi.XMLDeserializer):
def extract_metadata(self, metadata_node):
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index 0037fd64e..49e7b6645 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -237,7 +237,7 @@ class ViewBuilderV11(ViewBuilder):
def generate_next_link(self, server_id, params, is_detail=False):
""" Return an href string with proper limit and marker params"""
params['marker'] = server_id
- return "%s?%s" % (self.base_url, urllib.urlencode(params))
+ return "%s?%s" % (self.base_url, common.dict_to_query_str(params))
def generate_href(self, server_id):
"""Create an url that refers to a specific server id."""
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py
index bf8bbb2b8..160335d80 100644
--- a/nova/tests/api/openstack/test_servers.py
+++ b/nova/tests/api/openstack/test_servers.py
@@ -1188,7 +1188,7 @@ class ServersTest(test.TestCase):
self.assertTrue('limit' in res.body)
def test_get_server_details_with_limit_and_other_params_v1_1(self):
- req = webob.Request.blank('/v1.1/fake/servers/detail?limit=3&blah=2')
+ req = webob.Request.blank('/v1.1/fake/servers/detail?limit=3&blah=2:t')
res = req.get_response(fakes.wsgi_app())
servers = json.loads(res.body)['servers']
servers_links = json.loads(res.body)['servers_links']
@@ -1197,8 +1197,8 @@ class ServersTest(test.TestCase):
qs = urlparse.urlparse(servers_links[0]['href']).query
params = urlparse.parse_qs(qs)
- self.assertDictMatch({'limit': ['3'], 'blah': ['2'], 'marker': ['2']},
- params)
+ self.assertDictMatch({'limit': ['3'], 'blah': ['2:t'],
+ 'marker': ['2']}, params)
req = webob.Request.blank('/v1.1/fake/servers/detail?limit=aaa')
res = req.get_response(fakes.wsgi_app())