[Zope] Filtering HTML received via WebDAV

J. Cameron Cooper jccooper at jcameroncooper.com
Mon Nov 17 16:14:23 EST 2003


Warwick Barnes wrote:

> G'day! I've been searching Zope.org and the web in general for 
> information on the following, but can't find anything. I'd appreciate 
> it if anyone on this list had some ideas...
>  
> Is it possible to put in some sort of 'hook' function so that 
> HTML/DTML pages saved to the Zope database using WebDAV (or HTTP PUT 
> or FTP I guess) are filtered to remove 'bad' HTML before being saved 
> in the database.
>  
> I've written a function to strip HTML from the awful files produced by 
> Microsoft Word - leaving quite a clean page. I thought PUT_factory was 
> the place to hook something in, but that only seems to be for new files.
>  
> The 'holy grail' I'm looking for, is a setup where web pages can 
> actually be edited in Microsoft Word. On save I'd remove useless 
> Microsoft markup and add any other lines needed.

FTP and WebDAV use the PUT method on an object to upload data. (See the 
Zope Developer's Guide Chapter 2.) You can either subclass the Products 
you're interested in cleaning, patch Zope, or over-ride the method with 
a "monkey patch." You might also be able to override PUT TTW but that's 
a bit tricky (as you don't know exactly what you're being called on.)

             --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope mailing list