Skip to content

Commit

Permalink
Remove dysfunctional decoding (kamaki.cli.cmds)
Browse files Browse the repository at this point in the history
Closes grnet#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 18d5b05
The present commit completes the fix by undoing the decoding.
  • Loading branch information
saxtouri committed Sep 26, 2014
1 parent 50ca90b commit e6182f7
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
14 changes: 0 additions & 14 deletions kamaki/cli/cmds/cyclades.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,6 @@ def _run(self):
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)
Expand Down Expand Up @@ -275,12 +267,6 @@ def _run(self, server_id):
self.print_(self.client.get_server_diagnostics(server_id))
else:
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):
Expand Down
2 changes: 0 additions & 2 deletions kamaki/cli/cmds/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ def _run(self):
'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)
Expand Down
8 changes: 0 additions & 8 deletions kamaki/cli/cmds/pithos.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ def _container_info(self):
until=self['until'],
meta=self['meta'])
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

@errors.Generic.all
Expand Down Expand Up @@ -1602,10 +1598,6 @@ def _run(self):
show_only_shared=self['shared_by_me'],
public=self['public'])
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:
self._create_object_forest(files)
Expand Down

0 comments on commit e6182f7

Please sign in to comment.