storing the db connection somewhere under the active request is the
optimal thing to do -- it makes the db generally accessible throughout
the app.
there are some ways to make it easier to get to:
- if you use a class based approach to writing views, you could have a
base class that does much of the work
- you could write a helper function
class base_class(object):
def dbSession(self):
return self.request.root.db
def getDbSession(request=None):
if not request:
request= get_current_request():
return request.root.db
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.