# HG changeset patch # User Marcin Kuzminski # Date 1275422808 -7200 # Node ID 9d64df49024801fc618e913bc48dc1f91f1488d0 # Parent 5da4ef115006915c74c48cfc38890876d3d8712f fixed bug when there was no dbfile, and dbmanage raise an exception diff -r 5da4ef115006 -r 9d64df490248 pylons_app/lib/db_manage.py --- a/pylons_app/lib/db_manage.py Sun May 30 22:08:54 2010 +0200 +++ b/pylons_app/lib/db_manage.py Tue Jun 01 22:06:48 2010 +0200 @@ -26,10 +26,12 @@ engine = create_engine(dburi, echo=log_sql) init_model(engine) self.sa = Session() + self.db_exists = False def check_for_db(self, override): log.info('checking for exisiting db') if os.path.isfile(jn(ROOT, self.dbname)): + self.db_exists = True log.info('database exisist') if not override: raise Exception('database already exists') @@ -41,7 +43,8 @@ self.check_for_db(override) if override: log.info("database exisist and it's going to be destroyed") - os.remove(jn(ROOT, self.dbname)) + if self.db_exists: + os.remove(jn(ROOT, self.dbname)) Base.metadata.create_all(checkfirst=override) log.info('Created tables for %s', self.dbname)