[Zope] How best to "filter" all HTML output?
Casey Duncan
cduncan@kaivo.com
Fri, 23 Mar 2001 15:28:00 -0700
"Kyler B. Laird" wrote:
>
> I would like to use a common filter for the HTML
> output of any object in a folder. I want users to
> upload whatever HTML they want (from whatever
> horrible HTML generator) but then I want to be
> able to modify the HTML that results from that
> object.
>
> As a simple example, I want to be able to replace
> whatever is in "<title>" with the title of the
> object. I don't want the user to have to think
> about this; it should just happen any time an
> object generates HTML. (I realize that templates
> will eventually do something similar, but it will
> require that the user invoke the functionality.)
>
> I've thought of some ways to do this poorly. It
> will be such a big part of what we're doing
> however, that it is worthwhile for me to find an
> elegant solution. (I've done similar things in
> Apache over the years, but Zope has the potential
> to do it *much* better.)
>
> BTW, this functionality is sometimes used by
> providers wanting to force advertisements on
> their users' pages. That's not what I'm doing,
> but it is similar. (I seek to provide consistent
> navigation tools.)
>
> When I look at "Folder w/Customizer Support" I
> feel like I'm probably staring at the answer, but
> I'm not getting far in understanding it. I'd
> like to know if that's the right direction.
>
> Any thoughts?
>
> Thank you.
>
> --kyler
>
Python's HTMLLib could be used to parse the HTML provided by the user
enough for you to insert your own pieces into it. Then you could cache
the results beside the user's original HTML in a custom Zope object.
Check it out at:
http://www.python.org/doc/current/lib/module-htmllib.html
--
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>