1

I'm trying to develop an app using turbogears and sqlalchemy. There is already an existing app using kinterbasdb directly under mod_wsgi on the same server. When both apps are used, neither seems to recognize that kinterbasdb is already initialized Is there something non-obvious I am missing about using sqlalchemy and kinterbasdb in separate apps? In order to make sure only one instance of kinterbasdb gets initialized and both apps use that instance, does anyone have suggestions?

4

1 回答 1

2

我以为我已经发布了我的解决方案......

修改这两个应用程序以在其 httpd conf 文件中的 WSGIApplicationGroup ${GLOBAL} 下运行并修补 sqlalchemy.databases.firebird.py 以在调用 self.dbapi.init(... 之前检查 self.dbapi.initialized 是否为 True(... 是唯一的方法我可以设法让这个场景启动并运行
。SQLAlchemy 0.4.7 补丁:

diff -Naur SQLAlchemy-0.4.7/lib/sqlalchemy/databases/firebird.py SQLAlchemy-0.4.7.new/lib/sqlalchemy/databases/firebird.py
--- SQLAlchemy-0.4.7/lib/sqlalchemy/databases/firebird.py 2008-07-26 12:43:52.000000000 -0400
+++ SQLAlchemy-0.4.7.new/lib/sqlalchemy/databases/firebird.py 2008-10-01 10:51:22.000000000 -0400
@@ -291,7 +291,8 @@
         全局_initialized_kb
         如果不是 _initialized_kb 并且 self.dbapi 不是 None:
             _initialized_kb = 真
- self.dbapi.init(type_conv=type_conv, concurrency_level=concurrency_level)
+ 如果不是 self.dbapi.initialized:
+ self.dbapi.init(type_conv=type_conv, concurrency_level=concurrency_level)
         返回([],选择)

     def create_execution_context(self, *args, **kwargs):

于 2008-10-06T18:39:22.887 回答