On 13/03/2011 14:51, Chris Rossi wrote:
If it were me I would attach a connection factory instead of an open
connection. The factory would open a connection and stash it on the
request the first time it is invoked and then just return the stashed
connection on subsequent calls. This preserves the convenience of
your pattern but allows you to only cause a connection to be opened
for requests that need it.
I used the component-architecture-hidden-behind-functions approach that
has worked so well for Pyramid when I did mortar_rdb:
http://packages.python.org/mortar_rdb/api.html#mortar_rdb.registerSession
http://packages.python.org/mortar_rdb/api.html#mortar_rdb.getSession
Obviously, that won't help with MongoDB, but the thread-local and
zope.component utility approach might work for Seth too.
cheers,
Chris
PS: I'm at PyCon and sprinting on Pyramid, please come grab me if you
want to play aroun with this stuff :-)
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
--
You received this message because you are subscribed to the Google Groups
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/pylons-devel?hl=en.