On 7 May 2014 08:17, Jonathan Vanasco <[email protected]> wrote:

> @Laurence
>
> I'm not enthusiastic about the names for a slightly different reason
> after looking at the source of routes.py -- the names don't suggest the
> actual functionality
>
> 1) 'NewRequest' indicates the creation of a new request object.
>  pyramid/router.py line 78 shows that it does function more like a
> "BeforeDispatch"
> 2) 'NewResponse' indicates the creation of a new response object.  It was
> recently switched to act more like an "AfterResponseCallbacks" handler.
>

We'd have to keep NewRequest and NewResponse as BBB aliases so we don't
break existing code. New events notified from a different point would need
new names. I'm not attached to the particular names BeforeDispatch /
BeforeEgress, but I think it'd be good to choose ones that more obviously
indicate the relative ordering of the various hooks.


> I wonder if it makes sense to have both a "NewResponse" and
> "AfterResponseCallbacks" style events.  Would someone ever want to use the
> NewResponse event to examine the response and conditionally insert
> response_callbacks ?  I don't think so, but just want to bring this up.
>

I think you'd just run the code in the event handler itself at that point.
The response_callbacks / finished_callbacks are generally useful for
inserting cleanup code for something that ran earlier in the request.

Laurence

-- 
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