-----BEGIN PGP SIGNED MESSAGE-----
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.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKMoI5+gerLs4ltQ4RAoilAJ0Vo3Yz0Ww49mhXFlurmUwFlFXJ9wCg1cOn
lN/g6aP8KriaHZtkwZjHQ2M=
=b/14
-----END PGP SIGNATURE-----
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to