Use print_function compatible syntax

This changes the code to use a python 3.x compatible
print function syntax (or import from __future__ where
necessary)

Change-Id: Ia1f19d0ac082853d25c7c9b754b440469c0526eb
This commit is contained in:
Dirk Mueller 2013-06-24 15:41:51 +02:00
parent 123b386a1b
commit e6f6890ac0
7 changed files with 15 additions and 13 deletions

View File

@ -33,7 +33,7 @@ CONF = cfg.CONF
def do_db_version():
"""Print database's current migration level."""
print migration.db_version()
print(migration.db_version())
def do_db_sync():

View File

@ -318,13 +318,13 @@ class Debug(Middleware):
def __call__(self, req):
print ("*" * 40) + " REQUEST ENVIRON"
for key, value in req.environ.items():
print key, "=", value
print(key, "=", value)
print
resp = req.get_response(self.application)
print ("*" * 40) + " RESPONSE HEADERS"
for (key, value) in resp.headers.iteritems():
print key, "=", value
print(key, "=", value)
print
resp.app_iter = self.print_generator(resp.app_iter)

View File

@ -22,4 +22,4 @@ if __name__ == '__main__':
try:
main(url=sql_connection, debug='False', repository=migrate_repo_path)
except migrate.exceptions.DatabaseAlreadyControlledError:
print 'Database already version controlled.'
print('Database already version controlled.')

View File

@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import print_function
import gettext
import sys
@ -29,9 +31,9 @@ LOG = logging.getLogger(__name__)
if __name__ == '__main__':
print >>sys.stderr, '*******************************************'
print >>sys.stderr, 'Deprecated: use heat-manage db_sync instead'
print >>sys.stderr, '*******************************************'
print('*******************************************', file=sys.stderr)
print('Deprecated: use heat-manage db_sync instead', file=sys.stderr)
print('*******************************************', file=sys.stderr)
cfg.CONF(project='heat', prog='heat-engine')
api.configure()
@ -39,5 +41,5 @@ if __name__ == '__main__':
try:
migration.db_sync()
except Exception as exc:
print >>sys.stderr, str(exc)
print(str(exc), file=sys.stderr)
sys.exit(1)

View File

@ -72,9 +72,9 @@ class FakeClient(object):
try:
assert entry[2] == body
except AssertionError:
print entry[2]
print "!="
print body
print(entry[2])
print("!=")
print(body)
raise
self.client.callstack = []

View File

@ -41,5 +41,5 @@ class CliTest(testtools.TestCase):
stdout, stderr = proc.communicate()
if proc.returncode:
print 'Error executing %s:\n %s %s ' % (bin, stdout, stderr)
print('Error executing %s:\n %s %s ' % (bin, stdout, stderr))
raise subprocess.CalledProcessError(proc.returncode, bin)

View File

@ -31,7 +31,7 @@ class DummyTask(object):
yield
def do_step(self, step_num, *args, **kwargs):
print self, step_num
print(self, step_num)
class PollingTaskGroupTest(mox.MoxTestBase):