diff --git a/heatclient/common/base.py b/heatclient/common/base.py index 02b6a69c..16ea13cf 100644 --- a/heatclient/common/base.py +++ b/heatclient/common/base.py @@ -18,6 +18,7 @@ Base utilities to build API operation managers and objects on top of. """ import copy +import six # Python 2.4 compat @@ -86,7 +87,7 @@ class Resource(object): self._loaded = loaded def _add_details(self, info): - for (k, v) in info.iteritems(): + for (k, v) in six.iteritems(info): setattr(self, k, v) def __getattr__(self, k): diff --git a/heatclient/tests/test_shell.py b/heatclient/tests/test_shell.py index f90eceda..8bd9980b 100644 --- a/heatclient/tests/test_shell.py +++ b/heatclient/tests/test_shell.py @@ -11,10 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import cStringIO import httplib2 import os import re +import six import sys import urllib2 import yaml @@ -64,7 +64,7 @@ class TestCase(testtools.TestCase): def shell_error(self, argstr, error_match): orig = sys.stderr try: - sys.stderr = cStringIO.StringIO() + sys.stderr = six.StringIO() _shell = heatclient.shell.HeatShell() _shell.main(argstr.split()) except Exception as e: @@ -224,7 +224,7 @@ class ShellTest(TestCase): def shell(self, argstr): orig = sys.stdout try: - sys.stdout = cStringIO.StringIO() + sys.stdout = six.StringIO() _shell = heatclient.shell.HeatShell() _shell.main(argstr.split()) except SystemExit: @@ -654,7 +654,7 @@ class ShellEnvironmentTest(TestCase): fields = {'files': {}} if url: self.m.StubOutWithMock(urllib2, 'urlopen') - urllib2.urlopen(url).AndReturn(cStringIO.StringIO(content)) + urllib2.urlopen(url).AndReturn(six.StringIO(content)) self.m.ReplayAll() v1shell._resolve_environment_urls(fields, env_base_url, jenv) diff --git a/heatclient/v1/stacks.py b/heatclient/v1/stacks.py index ca80293c..c196e235 100644 --- a/heatclient/v1/stacks.py +++ b/heatclient/v1/stacks.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from heatclient.openstack.common.py3kcompat import urlutils from heatclient.common import base @@ -72,7 +72,7 @@ class StackManager(base.Manager): absolute_limit = kwargs.get('limit') def paginate(qp, seen=0): - url = '/stacks?%s' % urllib.urlencode(qp) + url = '/stacks?%s' % urlutils.urlencode(qp) stacks = self._list(url, "stacks") for stack in stacks: