[mod_python] mod_python / memcahced for on-the-fly renderingoflatex in html

Jay jayed at meangrape.com
Mon Apr 10 02:54:13 EDT 2006

One quick question about content-length...

On Sun, Apr 09, 2006 at 09:14:53PM -0400, Graham Dumpleton wrote:
> Graham Dumpleton wrote ..
> > 	<Location /your/directory>
> > 		PythonPath ['/var/www/python/htmlatex']+sys.path
> > 		PythonDebug Off
> > 		PythonOutputFilter htmlatex HTMLATEX
> > 		AddOutputFilter HTMLATEX;CONTENT_LENGTH .htmlx
> > 	</Location>
> > 
> > and you will get correct amended content length header added back in.
> > 
> > This works because you buffer up data and write it in one go. Thus the
> > CONTENT_LENGTH output filter is able to recalculate content length
> > for you.

> Using the "CONTENT_LENGTH" output filter should work though.

OK, CONTENT_LENGTH works great for htmlx files.  Now what I'd like to do
is just have the output filter handle all html files by doing

It works peachy keen for html files that, hah, contain equations.
Normal HTML files provide erratic content-length headers and stall
the browser out.  My first thought was to store the original content
length and if a filter.req didn't have any equations, to restore it
manually.  Then I remembered the "well, we tried it and it didn't work"
comments from the debianUK site.  (I'll stil give it a whirl later,

Any suggestions?  Does the *order* of the AddOutputFilter arguments make
a difference?  Is HTMLATEX;CONTENT_LENGTH different from
CONTENT_LENGTH;HTMLATEX? (My guess is that it is different, but one can
never tell).

Anyway, I've done a fairly substantial rewrite (insomuch as something
with only 250 lines can be referred to as 'substantial') so if you want
to take a gander at the code, it's at


More information about the Mod_python mailing list