Author: ianb
Date: 2006-05-09 11:06:33 -0600 (Tue, 09 May 2006)
New Revision: 1761
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/manager/command.py
Log:
Ignore error in sqlobject --create-db when database already exists
Modified: SQLObject/branches/0.7-bugfix/sqlobject/manager/command.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/manager/command.py 2006-05-09 16:37:31 UTC (rev 1760)
+++ SQLObject/branches/0.7-bugfix/sqlobject/manager/command.py 2006-05-09 17:06:33 UTC (rev 1761)
@@ -543,7 +543,13 @@
if (self.options.create_db
and soClass._connection not in dbs_created):
if not self.options.simulate:
- soClass._connection.createEmptyDatabase()
+ try:
+ soClass._connection.createEmptyDatabase()
+ except soClass._connection.module.ProgrammingError, e:
+ if str(e).find('already exists') != -1:
+ print 'Database already exists'
+ else:
+ raise
else:
print '(simulating; cannot create database)'
dbs_created.append(soClass._connection)
|