On 4/13/09 7:32 AM, Martin Aspeli wrote:
> Hi,
> I'm looking for something equivalent to plonepostpublicationhook
> (http://pypi.python.org/pypi/plone.postpublicationhook) for use with
> repoze.zope2.
> That is, I want to be able to install a component that can modify the
> response before it goes out to the client, whilst still having some
> knowledge of the site.
> It may be that this should just go in WSGI middleware "above" the zope2
> component. However, I also want to be able to perform traversal for an
> ESI-type use case. In particular:
>    - The "raw" response will contain links to things that need to be
> included dynamically.
>    - Those links will resolve to items inside a Plone site.
>    - It may be necessary to support two-phase rendering of all components
> to be included. That is, I'd need to find all linked entities, obtain
> them as objects, and call update() on each before calling render() on
> each and insert them into the output stream.
>    - I don't want the full request overhead of transactions,
> authentication etc for each "fetch".
> Any ideas on how/where best to do this?

If you only need to transform pages that are rendered as the result of 
that are not due to errors, you could modify the repoze.zope2 ObobHelper class' 
map_result method and add a line around line 527 that sends an event.

If you need to catch both responses without errors and responses with errors, 
currently the only place to do that is inside repoze.obob, as it is the thing 
that drives the repoze.zope2 helper.  To do this, we might could change 
repoze.obob's ObobPublisher.__call__ method to call something on the helper 
right before it calls "start_response" (e.g. around line 177:  status, headers, 
body_iter = helper.post_response(published, status, headers, body_iter)).  The 
helper code could send an event.

- C

Repoze-dev mailing list

Reply via email to