summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-04-28 18:02:01 +0200
committerClaude Paroz <claude@2xlibre.net>2012-04-30 20:45:03 +0200
commit596cb9c7e287abbb98c64974fb4944d522cb6b5a (patch)
treee8ad5402dd233458b392d1822146bb1102ba74a6 /django/db
parentfe43ad5707d116bb1729bc17a24ca16c90ae040d (diff)
Replaced print statement by print function (forward compatibility syntax).
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/creation.py14
-rw-r--r--django/db/backends/oracle/creation.py28
-rw-r--r--django/db/backends/sqlite3/creation.py4
3 files changed, 23 insertions, 23 deletions
diff --git a/django/db/backends/creation.py b/django/db/backends/creation.py
index e672253009..ba90cb970b 100644
--- a/django/db/backends/creation.py
+++ b/django/db/backends/creation.py
@@ -256,8 +256,8 @@ class BaseDatabaseCreation(object):
test_db_repr = ''
if verbosity >= 2:
test_db_repr = " ('%s')" % test_database_name
- print "Creating test database for alias '%s'%s..." % (
- self.connection.alias, test_db_repr)
+ print("Creating test database for alias '%s'%s..." % (
+ self.connection.alias, test_db_repr))
self._create_test_db(verbosity, autoclobber)
@@ -339,8 +339,8 @@ class BaseDatabaseCreation(object):
if autoclobber or confirm == 'yes':
try:
if verbosity >= 1:
- print ("Destroying old test database '%s'..."
- % self.connection.alias)
+ print("Destroying old test database '%s'..."
+ % self.connection.alias)
cursor.execute(
"DROP DATABASE %s" % qn(test_database_name))
cursor.execute(
@@ -351,7 +351,7 @@ class BaseDatabaseCreation(object):
"Got an error recreating the test database: %s\n" % e)
sys.exit(2)
else:
- print "Tests cancelled."
+ print("Tests cancelled.")
sys.exit(1)
return test_database_name
@@ -367,8 +367,8 @@ class BaseDatabaseCreation(object):
test_db_repr = ''
if verbosity >= 2:
test_db_repr = " ('%s')" % test_database_name
- print "Destroying test database for alias '%s'%s..." % (
- self.connection.alias, test_db_repr)
+ print("Destroying test database for alias '%s'%s..." % (
+ self.connection.alias, test_db_repr))
# Temporarily use a new connection and a copy of the settings dict.
# This prevents the production database from being exposed to potential
diff --git a/django/db/backends/oracle/creation.py b/django/db/backends/oracle/creation.py
index 758c9ecd4a..2f096f735a 100644
--- a/django/db/backends/oracle/creation.py
+++ b/django/db/backends/oracle/creation.py
@@ -69,19 +69,19 @@ class DatabaseCreation(BaseDatabaseCreation):
if autoclobber or confirm == 'yes':
try:
if verbosity >= 1:
- print "Destroying old test database '%s'..." % self.connection.alias
+ print("Destroying old test database '%s'..." % self.connection.alias)
self._execute_test_db_destruction(cursor, parameters, verbosity)
self._execute_test_db_creation(cursor, parameters, verbosity)
except Exception as e:
sys.stderr.write("Got an error recreating the test database: %s\n" % e)
sys.exit(2)
else:
- print "Tests cancelled."
+ print("Tests cancelled.")
sys.exit(1)
if self._test_user_create():
if verbosity >= 1:
- print "Creating test user..."
+ print("Creating test user...")
try:
self._create_test_user(cursor, parameters, verbosity)
except Exception as e:
@@ -91,16 +91,16 @@ class DatabaseCreation(BaseDatabaseCreation):
if autoclobber or confirm == 'yes':
try:
if verbosity >= 1:
- print "Destroying old test user..."
+ print("Destroying old test user...")
self._destroy_test_user(cursor, parameters, verbosity)
if verbosity >= 1:
- print "Creating test user..."
+ print("Creating test user...")
self._create_test_user(cursor, parameters, verbosity)
except Exception as e:
sys.stderr.write("Got an error recreating the test user: %s\n" % e)
sys.exit(2)
else:
- print "Tests cancelled."
+ print("Tests cancelled.")
sys.exit(1)
self.connection.settings_dict['SAVED_USER'] = self.connection.settings_dict['USER']
@@ -136,17 +136,17 @@ class DatabaseCreation(BaseDatabaseCreation):
time.sleep(1) # To avoid "database is being accessed by other users" errors.
if self._test_user_create():
if verbosity >= 1:
- print 'Destroying test user...'
+ print('Destroying test user...')
self._destroy_test_user(cursor, parameters, verbosity)
if self._test_database_create():
if verbosity >= 1:
- print 'Destroying test database tables...'
+ print('Destroying test database tables...')
self._execute_test_db_destruction(cursor, parameters, verbosity)
self.connection.close()
def _execute_test_db_creation(self, cursor, parameters, verbosity):
if verbosity >= 2:
- print "_create_test_db(): dbname = %s" % parameters['dbname']
+ print("_create_test_db(): dbname = %s" % parameters['dbname'])
statements = [
"""CREATE TABLESPACE %(tblspace)s
DATAFILE '%(tblspace)s.dbf' SIZE 20M
@@ -161,7 +161,7 @@ class DatabaseCreation(BaseDatabaseCreation):
def _create_test_user(self, cursor, parameters, verbosity):
if verbosity >= 2:
- print "_create_test_user(): username = %s" % parameters['user']
+ print("_create_test_user(): username = %s" % parameters['user'])
statements = [
"""CREATE USER %(user)s
IDENTIFIED BY %(password)s
@@ -174,7 +174,7 @@ class DatabaseCreation(BaseDatabaseCreation):
def _execute_test_db_destruction(self, cursor, parameters, verbosity):
if verbosity >= 2:
- print "_execute_test_db_destruction(): dbname=%s" % parameters['dbname']
+ print("_execute_test_db_destruction(): dbname=%s" % parameters['dbname'])
statements = [
'DROP TABLESPACE %(tblspace)s INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS',
'DROP TABLESPACE %(tblspace_temp)s INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS',
@@ -183,8 +183,8 @@ class DatabaseCreation(BaseDatabaseCreation):
def _destroy_test_user(self, cursor, parameters, verbosity):
if verbosity >= 2:
- print "_destroy_test_user(): user=%s" % parameters['user']
- print "Be patient. This can take some time..."
+ print("_destroy_test_user(): user=%s" % parameters['user'])
+ print("Be patient. This can take some time...")
statements = [
'DROP USER %(user)s CASCADE',
]
@@ -194,7 +194,7 @@ class DatabaseCreation(BaseDatabaseCreation):
for template in statements:
stmt = template % parameters
if verbosity >= 2:
- print stmt
+ print(stmt)
try:
cursor.execute(stmt)
except Exception as err:
diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py
index 9e660fa387..efdc457be0 100644
--- a/django/db/backends/sqlite3/creation.py
+++ b/django/db/backends/sqlite3/creation.py
@@ -50,7 +50,7 @@ class DatabaseCreation(BaseDatabaseCreation):
if test_database_name != ':memory:':
# Erase the old test database
if verbosity >= 1:
- print "Destroying old test database '%s'..." % self.connection.alias
+ print("Destroying old test database '%s'..." % self.connection.alias)
if os.access(test_database_name, os.F_OK):
if not autoclobber:
confirm = raw_input("Type 'yes' if you would like to try deleting the test database '%s', or 'no' to cancel: " % test_database_name)
@@ -61,7 +61,7 @@ class DatabaseCreation(BaseDatabaseCreation):
sys.stderr.write("Got an error deleting the old test database: %s\n" % e)
sys.exit(2)
else:
- print "Tests cancelled."
+ print("Tests cancelled.")
sys.exit(1)
return test_database_name