Fix some trivial py3 errors

Change-Id: I72334d2ca82057e591dca4fcfa9ef7ecdd3b6878
This commit is contained in:
Chmouel Boudjnah 2014-01-10 21:09:46 +01:00
parent 97d945e879
commit b293243185
3 changed files with 8 additions and 8 deletions

View File

@ -30,7 +30,7 @@ import os
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
execfile(os.path.join("ext", "gen_ref.py"))
exec(open(os.path.join("ext", "gen_ref.py")).read())
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be

View File

@ -56,7 +56,7 @@ class TestCase(testtools.TestCase):
# required for testing with Python 2.6
def assertRegexpMatches(self, text, expected_regexp, msg=None):
"""Fail the test unless the text matches the regular expression."""
if isinstance(expected_regexp, basestring):
if isinstance(expected_regexp, six.string_types):
expected_regexp = re.compile(expected_regexp)
if not expected_regexp.search(text):
msg = msg or "Regexp didn't match"

View File

@ -361,9 +361,9 @@ def do_template_show(hc, args):
raise exc.CommandError('Stack not found: %s' % args.id)
else:
if 'heat_template_version' in template:
print yaml.safe_dump(template, indent=2)
print(yaml.safe_dump(template, indent=2))
else:
print jsonutils.dumps(template, indent=2)
print(jsonutils.dumps(template, indent=2))
@utils.arg('-u', '--template-url', metavar='<URL>',
@ -404,7 +404,7 @@ def do_template_validate(hc, args):
_process_environment_and_files(args, fields)
validation = hc.stacks.validate(**fields)
print jsonutils.dumps(validation, indent=2)
print(jsonutils.dumps(validation, indent=2))
@utils.arg('id', metavar='<NAME or ID>',
@ -471,9 +471,9 @@ def do_resource_template(hc, args):
raise exc.CommandError('Resource %s not found.' % args.resource)
else:
if args.format:
print utils.format_output(template, format=args.format)
print(utils.format_output(template, format=args.format))
else:
print utils.format_output(template)
print(utils.format_output(template))
@utils.arg('id', metavar='<NAME or ID>',
@ -490,7 +490,7 @@ def do_resource_metadata(hc, args):
raise exc.CommandError('Stack or resource not found: %s %s' %
(args.id, args.resource))
else:
print jsonutils.dumps(metadata, indent=2)
print(jsonutils.dumps(metadata, indent=2))
@utils.arg('id', metavar='<NAME or ID>',