diff pylons_app/lib/db_manage.py @ 350:664a5b8c551a

Added application settings, are now customizable from database fixed all instances of sqlachemy to be removed() after execution.
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 14 Jul 2010 18:31:06 +0200
parents bb8f45f6d8f9
children d09381593b12
line wrap: on
line diff
--- a/pylons_app/lib/db_manage.py	Wed Jul 14 18:15:37 2010 +0200
+++ b/pylons_app/lib/db_manage.py	Wed Jul 14 18:31:06 2010 +0200
@@ -34,7 +34,7 @@
 from pylons_app.lib.auth import get_crypt_password
 from pylons_app.model import init_model
 from pylons_app.model.db import User, Permission, HgAppUi, HgAppSettings
-from pylons_app.model.meta import Session, Base
+from pylons_app.model import meta
 from sqlalchemy.engine import create_engine
 import logging
 
@@ -51,7 +51,7 @@
         dburi = 'sqlite:////%s' % jn(ROOT, self.dbname)
         engine = create_engine(dburi, echo=log_sql) 
         init_model(engine)
-        self.sa = Session()
+        self.sa = meta.Session
         self.db_exists = False
     
     def check_for_db(self, override):
@@ -71,7 +71,7 @@
             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)
+        meta.Base.metadata.create_all(checkfirst=override)
         log.info('Created tables for %s', self.dbname)
     
     def admin_prompt(self):