On 6/25/10 20:03 , Wichert Akkerman wrote:
> The way I've setup repoze.zodbconn is
>
> from repoze.zodbconn.finder import PersistentApplicationFinder
> from myproject import appmaker
> finder = PersistentApplicationFinder(settings["zodb.url"], appmaker)
> def get_root(request):
> return finder(request.environ)
> return get_root
[.. snip ..]
> What I think should be done is to open the ZODB connection on app
> startup and only appmaker(conn.root90) per request. ZODB should then
> care of per-thread connection management itself. I see no way to
> accomplish that using the code in repoze.zodbconn, so I am wondering if
> I missed something critical or if this is indeed a bug in repoze.zodbconn.
I've rewritten my code to look like this:
from repoze.zodbconn.uri import db_from_uri
db=db_from_uri(settings["zodb.url"])
conn=db.open()
def get_root(request):
return appmaker(conn.root())
return get_root
and removed the EnvironmentDeleterMiddleware from the WSGI chain since I
no longer put anything in environ. So far it looks like this works, but
I'ld like some confirmation from the gurus here.
Wichert.
_______________________________________________
Repoze-dev mailing list
[email protected]
http://lists.repoze.org/listinfo/repoze-dev