On Wednesday, March 12, 2014 3:46:04 AM UTC-7, Atul Agrawal wrote:
>
> Hello Everyone,
>
> I wanted my server to perform some task on every request that any user 
> makes to my pyramid server.
> So I think of extending code where a request initialistaion is 
> made.Something like overriding initialise function here:
> https://webapp-improved.appspot.com/api/webapp2.html#webapp2.RequestHandler.initialize
>
> Is there any better way to do this in pyramid?
>

It depends on what the task is. If you don't need access to the Pyramid 
environment, you could just create a straight up WSGI middleware--that's 
simple and portable. If you do need/want access to the Pyramid environment, 
you could create a tween instead. The simplest thing would probably be a 
NewRequest subscriber, but that's not appropriate for every situation 
(e.g., it might be fired too late into request processing for your 
purposes).

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to