py34: fix convert_dicts_to_lists
keys() is an iterator in python3 and doesn't support indexing values() is an iterator too and cannot be sorted Change-Id: I02fcf72efbf1a30135873572ee4b78dff85b7b87
This commit is contained in:
parent
5ba78c4ec9
commit
23a94de725
|
@ -19,6 +19,7 @@ APIRequest class
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
import six
|
||||||
|
|
||||||
from ec2api.api import cloud
|
from ec2api.api import cloud
|
||||||
from ec2api.api import ec2utils
|
from ec2api.api import ec2utils
|
||||||
|
@ -69,11 +70,12 @@ class APIRequest(object):
|
||||||
if isinstance(args[key], dict):
|
if isinstance(args[key], dict):
|
||||||
if args[key] == {}:
|
if args[key] == {}:
|
||||||
continue
|
continue
|
||||||
if args[key].keys()[0].isdigit():
|
first_subkey = next(six.iterkeys(args[key]))
|
||||||
s = args[key].items()
|
if first_subkey.isdigit():
|
||||||
s.sort()
|
s = args[key]
|
||||||
args[key] = [convert_dicts_to_lists(v) for k, v in s]
|
args[key] = [convert_dicts_to_lists(s[k])
|
||||||
elif (args[key].keys()[0] == 'value' and
|
for k in sorted(s)]
|
||||||
|
elif (first_subkey == 'value' and
|
||||||
len(args[key]) == 1):
|
len(args[key]) == 1):
|
||||||
args[key] = args[key]['value']
|
args[key] = args[key]['value']
|
||||||
return args
|
return args
|
||||||
|
|
Loading…
Reference in New Issue