diff rhodecode/lib/utils.py @ 3340:f1491bad8339 beta

unified RhodeCode paster commands - moved them to commont paster_commands package - re-use sqlalchemy session initializaiton - some docs updates
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 09 Feb 2013 22:21:31 +0100
parents ba2e2514a01a
children 7000fc4aa569
line wrap: on
line diff
--- a/rhodecode/lib/utils.py	Sat Feb 09 19:45:10 2013 +0100
+++ b/rhodecode/lib/utils.py	Sat Feb 09 22:21:31 2013 +0100
@@ -704,6 +704,20 @@
         conf = paste.deploy.appconfig('config:' + self.path_to_ini_file)
         pylonsconfig.init_app(conf.global_conf, conf.local_conf)
 
+    def _init_session(self):
+        """
+        Inits SqlAlchemy Session
+        """
+        logging.config.fileConfig(self.path_to_ini_file)
+        from pylons import config
+        from rhodecode.model import init_model
+        from rhodecode.lib.utils2 import engine_from_config
+
+        #get to remove repos !!
+        add_cache(config)
+        engine = engine_from_config(config, 'sqlalchemy.db1.')
+        init_model(engine)
+
 
 def check_git_version():
     """