Commit 92573be9 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Remove dysfunctional decoding (kamaki.cli.cmds)

Refs grnet/kamaki#32

String decoding was used to deal with unicode strings, which were
encoded as "unicode_escape" in earlier steps. The later was wrong and
it was fixed with 18d5b053
The present commit completes the fix by undoing the decoding.
parent 67eefb95
......@@ -204,14 +204,6 @@ class server_list(_CycladesInit, OptionalOutput, NameFilter, IDFilter):
withimage or withflavor or withmeta or withcommons)
ch_since = self.arguments['since'].isoformat if self['since'] else None
servers = list(self.client.list_servers(detail, ch_since) or [])
for item in servers:
for k in ('name', ):
item[k] = item[k].decode('unicode_escape')
if 'metadata' in item:
ms = dict()
for k, v in item['metadata'].items():
ms[k.decode('unicode_escape')] = v.decode('unicode_escape')
item['metadata'] = ms
servers = self._filter_by_name(servers)
servers = self._filter_by_id(servers)
......@@ -275,12 +267,6 @@ class server_info(_CycladesInit, OptionalOutput):
vm = self.client.get_server_details(server_id)
vm['name'] = vm.get('name', '').decode('unicode_escape')
if 'metadata' in vm:
ms = dict()
for k, v in vm['metadata'].items():
ms[k.decode('unicode_escape')] = v.decode('unicode_escape')
vm['metadata'] = ms
self.print_(vm, self.print_dict)
def main(self, server_id):
......@@ -203,8 +203,6 @@ class image_list(_ImageInit, OptionalOutput, NameFilter, IDFilter):
'detail', 'prop', 'prop_like', 'owner', 'owner_name')])
images = self.client.list_public(detail, filters, order)
for img in images:
img['name'] = img['name'].decode('unicode_escape')
if self['owner'] or self['owner_name']:
images = self._filter_by_owner(images)
......@@ -296,10 +296,6 @@ class file_list(_PithosContainer, OptionalOutput, NameFilter):
files = list(r.json or [])
for item in files:
for k in ('name', ):
if k in item:
item[k] = item[k].decode('unicode_escape')
return files
......@@ -1602,10 +1598,6 @@ class container_list(_PithosAccount, OptionalOutput, NameFilter):
items = list(r.json or [])
for item in items:
for k in ('name', ):
if k in item:
item[k] = item[k].decode('unicode_escape')
files = self._filter_by_name(items)
if self['recursive'] and not container:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment