Changeset - 9d64df490248
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-06-01 22:06:48
marcin@python-works.com
fixed bug when there was no dbfile, and dbmanage raise an exception
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/db_manage.py
Show inline comments
 
@@ -26,10 +26,12 @@ class DbManage(object):
 
        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,6 +43,7 @@ class DbManage(object):
 
        self.check_for_db(override)
 
        if override:
 
            log.info("database exisist and it's going to be destroyed")
 
            if self.db_exists:
 
            os.remove(jn(ROOT, self.dbname))
 
        Base.metadata.create_all(checkfirst=override)
 
        log.info('Created tables for %s', self.dbname)
0 comments (0 inline, 0 general)