apirequest.py (ec2-api-14.0.1) | : | apirequest.py (ec2-api-15.0.0) | ||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | |||
# limitations under the License. | # limitations under the License. | |||
""" | """ | |||
APIRequest class | 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 | |||
from ec2api import exception | from ec2api import exception | |||
CONF = cfg.CONF | CONF = cfg.CONF | |||
LOG = logging.getLogger(__name__) | LOG = logging.getLogger(__name__) | |||
def _underscore_to_camelcase(st): | def _underscore_to_camelcase(st): | |||
return ''.join([x[:1].upper() + x[1:] for x in st.split('_')]) | return ''.join([x[:1].upper() + x[1:] for x in st.split('_')]) | |||
skipping to change at line 66 | skipping to change at line 65 | |||
def convert_dicts_to_lists(args): | def convert_dicts_to_lists(args): | |||
if not isinstance(args, dict): | if not isinstance(args, dict): | |||
return args | return args | |||
for key in args.keys(): | for key in args.keys(): | |||
# NOTE(vish): Turn numeric dict keys into lists | # NOTE(vish): Turn numeric dict keys into lists | |||
# NOTE(Alex): Turn "value"-only dict keys into values | # NOTE(Alex): Turn "value"-only dict keys into values | |||
if isinstance(args[key], dict): | if isinstance(args[key], dict): | |||
if args[key] == {}: | if args[key] == {}: | |||
continue | continue | |||
first_subkey = next(six.iterkeys(args[key])) | first_subkey = next(iter(args[key].keys())) | |||
if first_subkey.isdigit(): | if first_subkey.isdigit(): | |||
s = args[key] | s = args[key] | |||
args[key] = [convert_dicts_to_lists(s[k]) | args[key] = [convert_dicts_to_lists(s[k]) | |||
for k in sorted(s)] | for k in sorted(s)] | |||
elif (first_subkey == 'value' and | 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 | |||
args = convert_dicts_to_lists(args) | args = convert_dicts_to_lists(args) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added |