[Zope] Cleaning HTML for use as ZPT

Paul Winkler pw_lists at slinkp.com
Tue Aug 19 13:24:35 EDT 2003


On Tue, Aug 19, 2003 at 09:19:18AM -0700, Robert Jean wrote:
> Dennis,
> 
> Thanks for your response.
> 
> I don't understand what you mean by "use TAL and/or
> DTML to invoke it". Invoke what?

maybe he meant import the old stuff as a File or a DTML
method or some such, then in another ZPT do a 
<foo tal:replace="structure here/broken_html_thingie" />

> The old malformed HTML has to be rendered by TAL,
> because after being imported, it is modified and
> contains a few TAL macros.

ah, ok. If it's really necessary to do this on the server side,
I'd make an upload form, have its target be an an External 
Method that does roughly this:

- pipe the file data to and from Tidy, probably using os.popen2().
  (there's an option for Tidy to create valid XHTML, use that.)

- create a ZPT from the cleaned up output. (probably the id to use is
  one of the parameters passed from your upload form...)

But, if you are doing a bunch at once, easier would be to just run
Tidy on the filesystem and then upload the results to zope...

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's THE POUNCING PADDLE!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list