[Zope] filtering results
dieter at handshake.de
Fri Apr 7 14:09:14 EDT 2006
gf wrote at 2006-4-6 12:06 -0600:
>I am a Zope newbie. I apologize if the terminology I use below is not
>correct, but I hope that you get the gist of what I am about to ask.
>I would like to be able to 'filter' results before returning them to
>the user. In other words, if a user requests a given object, it is
>passed through a filter before being passed on to him or her. As a
>simple example, I may want to tidy the html before the user sees it,
>or eliminate or add certain tags or words.
>I have put together a simple 'html tidy' external method that takes
>raw html and produces a tidied version, but I don't know how I can
The current Zope version does not support general post processing.
Depending on your precise use cases, you have various options:
* change "ZPublisher.HTTPResponse.HTTPResponse" to
perform postprocessing it its "setBody".
* change "ZPublisher.Publish.publish_module" to add
* use a PythonScript and its "traverse_subpath" feature.
When traversal reaches a PythonScript, then traversal
stops and the remaining traversal steps are
made available in the scripts "traverse_subpath".
The script can try to locate the object identified
by the "traverse_subpath" and call it.
It then can perform post processing on the result.
This usually works for templates and parameterless scripts.
Passing parameters to scripts is difficult.
You probably would like to make "ZPublisher.mapply.mapply"
available in untrusted code for this.
The approach will also fail when the user can only be authenticated
below the script.
>Thank you for any comments, suggestions, or simple examples you may be
>able to provide.
More information about the Zope