[mod_python] output filters: selection criteria and slowness

Rob Miller ra at burningman.com
Fri Jul 21 16:53:27 EDT 2006


hi,

i know python pretty well, but i'm a mod_python (mod_*, really) beginner, and 
i'm having some trouble getting an output filter to work for me.  i'm trying 
to apply a filter to content that is being served from a CMS and proxied 
through apache using RewriteRules.   i've got it working, sort of, but there 
are a couple of major snags i've hit:

- the content coming from the other system doesn't necessarily have a file 
extension.  i can use 'SetOutputFilter" to apply the filter to everything, but 
i don't WANT to apply it to images or other binary data.  is there a way to 
use "AddOutputFilter" for files with no extension?  or to use it as an 
extension blacklist, rather than a whitelist?  or would this have to be done 
as logic in the filter itself?

- when i apply the filter to static content coming from a hard drive, it works 
very well.  when i apply it to content from the CMS, however, it is extremely 
slow.  a single page can take anywhere from 15 to 45 seconds to return.  (note 
that if i browse directly to the CMS the page returns are also quite fast.) 
it seems like a lot of information comes down right away but firefox churns as 
though it's still waiting.  when i use wget, the page seems to get requested 
over and over again, with wget never realizing it's done.  my guess is it has 
something to do w/ the content-length header, but i've deleted it from request 
before writing to the filter object as shown in the examples i've found.

i'm using mod_python 3.1.4 and apache 2.0.55 from ubuntu dapper.  the code of 
my filter is here: 
http://codespeak.net/svn/z3/deliverance/branches/namespaced/mpfilter.py

anyone have suggestions, or pointers to docs, that might help me?

thanks!

-r



More information about the Mod_python mailing list