On 07-05-2014, Laurence Rowe wrote:
> ------=_Part_5208_31847681.1399448222738
> Content-Type: text/plain; charset=UTF-8
>
>
>
> On Tuesday, 6 May 2014 13:08:23 UTC-7, Jonathan Vanasco wrote:
>>
>> This doesn't make much sense to me.
>>
>> Wouldn't there be much more utility to have the response_callback AFTER 
>> the response is created, this way it can operate on the response object?
>>
>> I did some digging in the source, and came across this change:
>>
>>       
>> https://github.com/Pylons/pyramid/commit/fc477b2e4b20ae2788e468e45b2831e774be8ced
>>
>> and this issue:
>>
>> https://github.com/Pylons/pyramid/issues/1116
>> So now it makes perfect sense.
>> It's probably worth discussing this in the docs near the "Response 
>> Callbacks" and "NewResponse" sections.
>>
>> Chris's text in the commit is perfect:
>>
>>    The ``pyramid.events.NewResponse`` event is now sent **after** response 
>> callbacks are executed.  It previously executed before response callbacks 
>> were executed.  Rationale: it's more useful to be able to inspect the 
>> response after response callbacks have done their jobs instead of before.
>>
>>
> Including more hooks, I think this is the execution order:
>
>    1. request extensions
>    2. tween in
>    3. NewRequest
>    4. ContextFound
>    5. view
>    6. BeforeRender (if view did not return a Response)
>    7. renderer (if view did not return a Response)

I think it miss some events here, after view but inside tween to keep 
the features of the tweens (debug, log, transaction...).
Or response_callbacks and NewResponse should be inside tween ?

Though it's not difficult to do with our own tween and own event. It's 
what i do to mimic my framework.

>    8. tween out
>    9. request.response_callbacks
>    10. NewResponse
>    11. request.finished_callbacks
>
> I was a little surprised by the placement of NewResponse in the list too, I 
> haven't used it yet and assumed it would be notified during the 
> response_factory. Though if that were the case, it would not be notified 
> for exceptions or explicit responses. If it went before tween out, then it 
> would not be notified on exception views.
>
> Given NewRequest and NewResponse are not notified symmetrically, perhaps 
> BeforeDispatch and BeforeEgress would be better names?
>
> We should also fix the order 
> in http://docs.pylonsproject.org/projects/pyramid/en/latest/api/events.html 
> as NewResponse comes between ContextFound and BeforeRender in that list.
>
> Laurence
>


-- 
William

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