Hash: SHA1

Shane Hathaway wrote:

> I have been working with repoze.zodbconn (in conjunction with repoze.bfg 
> and Karl 3) and there have been several times when I wish I could just 
> insert some WSGI component that does something with the ZODB connection. 
>   Specifically:
> - At one point I wanted repoze.who.plugins.zodb to use the same 
> connection as the application uses.  We shouldn't have to set up the 
> ZODB connection twice on every request.  The cost is low but measurable.
> - I wanted to create a WSGI logger that watches how many objects are 
> loaded or stored by the handler for a request.

Heh, I worked on that a bit, as you know:  the custom cleanup object
stuff was in support of that use case.

> - Right now, I want to fine-tune the contents of the ZODB cache after 
> every request.
> To make tasks like these easier, I would like to add to repoze.zodbconn 
> a WSGI framework component that opens a ZODB connection, puts that 
> connection in the WSGI environment, calls the next WSGI app in the 
> chain, then closes the same ZODB connection on the way out.  I intend to 
> add it myself, but I would like to hear any feedback the group might 
> have before I do it.

I considered doing such a piece of middleware myself:  the asymmetry of
the "open in the app, close when the environ is destroyed" pattern
bothers me.

We would need to update docs to show how to use the shared connection
with a BFG app, I think, including requiring that this new middleware be
to the "left" of the repoze.tm{,2} middleware.  We should also
illustrate writing the app such that it can function without the shared
connection, on the principle that the app should still function even in
the absence of any specific piece of it.

+1 from me.

- --
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

Repoze-dev mailing list

Reply via email to