Merge "Encode unicode filter arguments for server list"

This commit is contained in:
Jenkins 2015-09-19 03:24:39 +00:00 committed by Gerrit Code Review
commit 527df930be
2 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,12 @@ class ServersTest(utils.FixturedTestCase):
for s in sl: for s in sl:
self.assertIsInstance(s, servers.Server) self.assertIsInstance(s, servers.Server)
def test_filter_servers_unicode(self):
sl = self.cs.servers.list(search_opts={'name': u't€sting'})
self.assert_called('GET', '/servers/detail?name=t%E2%82%ACsting')
for s in sl:
self.assertIsInstance(s, servers.Server)
def test_list_all_servers(self): def test_list_all_servers(self):
# use marker just to identify this call in fixtures # use marker just to identify this call in fixtures
sl = self.cs.servers.list(limit=-1, marker=1234) sl = self.cs.servers.list(limit=-1, marker=1234)

View File

@ -570,6 +570,8 @@ class ServerManager(base.BootingManagerWithFind):
for opt, val in six.iteritems(search_opts): for opt, val in six.iteritems(search_opts):
if val: if val:
if isinstance(val, six.text_type):
val = val.encode('utf-8')
qparams[opt] = val qparams[opt] = val
detail = "" detail = ""