How To Create Per-Request Singleton in Pylons?

Posted by dave mankoff on Stack Overflow See other posts from Stack Overflow or by dave mankoff
Published on 2010-05-11T15:31:36Z Indexed on 2010/05/11 15:34 UTC
Read the original article Hit count: 378

Filed under:
|
|

In our Pylons based web-app, we're creating a class that essentially provides some logging functionality. We need a new instance of this class for each http request that comes in, but only one per request.

What is the proper way to go about this? Should we just create the object in middleware and store in in request.environ? Is there a more appropriate way to go about this?

© Stack Overflow or respective owner

Related posts about python

Related posts about pylons