]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use print_function compatible syntax
authorDirk Mueller <dirk@dmllr.de>
Mon, 24 Jun 2013 13:41:51 +0000 (15:41 +0200)
committerDirk Mueller <dirk@dmllr.de>
Mon, 24 Jun 2013 13:41:51 +0000 (15:41 +0200)
This changes the code to use a python 3.x compatible
print function syntax (or import from __future__ where
necessary)

Change-Id: Ia1f19d0ac082853d25c7c9b754b440469c0526eb

heat/cmd/manage.py
heat/common/wsgi.py
heat/db/sqlalchemy/manage.py
heat/db/sync.py
heat/tests/fakes.py
heat/tests/test_cli.py
heat/tests/test_scheduler.py

index 97262d81e2f438ed23f6701e39cb3ad89a20e910..1f19185f33367f8152804147214ee1964b440df3 100644 (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():
index 4b31d30f6199cf8ffa0100633fa01d4e36523f5e..e6289946449514e7783f52febaa695612b531f56 100644 (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)
index dabb204cbd9becea374c6aaabb455e0b760b64d4..4d57542e5e41842e2de76d21b080e17868504587 100755 (executable)
@@ -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.')
index 9855fb3fdd38032e14ab73a1b463cb2c626a355e..d95d6c556ba53bfab293231a103ea3198da7b1d0 100755 (executable)
@@ -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)
index f4e2fa82d35e2ad4e44217023cdf1d8c3c398009..7e8d3154e11775dd898fb975f2cdf485e4a4eeda 100644 (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 = []
index bafb4d45498f937e97025238af83bbae907f533d..464ce6b6eb34947df8136e1b11e4e1bbc5f596d6 100644 (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)
index 7d12c912f21de7c1871a7591b2188604086c0e88..ac20a88eda354d977622100dcdb2b466cdd0adbc 100644 (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):