[Zope-dev] ZPublisher events before streaming a response

Martin Aspeli optilude+lists at gmail.com
Sun Mar 21 08:08:40 EDT 2010


Hanno Schlichting wrote:
> On Sun, Mar 21, 2010 at 12:05 PM, Martin Aspeli
> <optilude+lists at gmail.com>  wrote:
>> Hanno Schlichting wrote:
>>> Why would you need to have the event on the request, if all you want
>>> is to set headers? Why not make it an event with the response as the
>>> argument instead?
>> Mainly because that's what all the other IPub* events carry with them.
>> We discovered this omission implementing plone.caching, which only needs
>> the response, but it's not all that unlikely that something else may
>> need the request.
>
> At the point where you start out writing the actual response
> byte-stream, I think it's too late to do anything useful with the
> request.
>
> But consistency is good, so maybe the different nature of the event
> could be reflected in the event name more clearly.
>
>> Of course, "something else" could do the same getSite() trick if needed,
>> or use five.globalrequest.
>
> Yes, please. Unless there's a real need for such a hack, I'd rather
> not see it in Zope2.

Would you be happy with the approach outlined if the event carried just 
the response instead?

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope-Dev mailing list