diff --git a/designateclient/cli/base.py b/designateclient/cli/base.py index 165ffbd..890850a 100644 --- a/designateclient/cli/base.py +++ b/designateclient/cli/base.py @@ -106,17 +106,17 @@ class ListCommand(Command, Lister): class GetCommand(Command, ShowOne): def post_execute(self, results): - return results.keys(), results.values() + return list(six.iterkeys(results)), list(six.itervalues(results)) class CreateCommand(Command, ShowOne): def post_execute(self, results): - return results.keys(), results.values() + return list(six.iterkeys(results)), list(six.itervalues(results)) class UpdateCommand(Command, ShowOne): def post_execute(self, results): - return results.keys(), results.values() + return list(six.iterkeys(results)), list(six.itervalues(results)) class DeleteCommand(Command, ShowOne): diff --git a/designateclient/client.py b/designateclient/client.py index 6140c91..c5b6024 100644 --- a/designateclient/client.py +++ b/designateclient/client.py @@ -124,6 +124,6 @@ def Client(version, *args, **kwargs): # noqa versions = get_versions() if version not in versions: msg = 'Version %s is not supported, use one of (%s)' % ( - version, versions.keys()) + version, list(six.iterkeys(versions))) raise exceptions.UnsupportedVersion(msg) return versions[version](*args, **kwargs) diff --git a/designateclient/utils.py b/designateclient/utils.py index ea5d48b..6cdcfb8 100644 --- a/designateclient/utils.py +++ b/designateclient/utils.py @@ -23,6 +23,7 @@ from keystoneclient.auth.identity import generic from keystoneclient.auth import token_endpoint from keystoneclient import session as ks_session import pkg_resources +import six from designateclient import exceptions @@ -94,7 +95,8 @@ def get_columns(data): def _seen(col): columns.add(str(col)) - map(lambda item: map(_seen, item.keys()), data) + six.moves.map(lambda item: six.moves.map(_seen, + list(six.iterkeys(item))), data) return list(columns) diff --git a/designateclient/warlock.py b/designateclient/warlock.py index 2e54b26..c2c72a8 100644 --- a/designateclient/warlock.py +++ b/designateclient/warlock.py @@ -20,6 +20,7 @@ import copy import logging import jsonschema +import six LOG = logging.getLogger(__name__) @@ -112,19 +113,19 @@ def model_factory(schema): dict.update(self, other) def iteritems(self): - return copy.deepcopy(dict(self)).iteritems() + return six.iteritems(copy.deepcopy(dict(self))) def items(self): - return copy.deepcopy(dict(self)).items() + return list(six.iteritems(copy.deepcopy(dict(self)))) def itervalues(self): - return copy.deepcopy(dict(self)).itervalues() + return six.itervalues(copy.deepcopy(dict(self))) def keys(self): - return copy.deepcopy(dict(self)).keys() + return list(six.iterkeys(copy.deepcopy(dict(self)))) def values(self): - return copy.deepcopy(dict(self)).values() + return list(six.itervalues(copy.deepcopy(dict(self)))) @property def changes(self):