Graham Dumpleton
grahamd at dscpl.com.au
Sun Apr 9 21:14:53 EDT 2006
Graham Dumpleton wrote .. > Jay wrote .. > > > > Hi, > > > > I've spent a lot of time in the past embedding latex into HTML pages. > > All of the solutions I've come across fall short in one way or > > another. > > > > I've spent the last few days knocking together a little mod_python > > app that utilizes memcached to do as-needed rendering of latex > > embedded in HTML. > > > > If anyone is interested, feel free to take a look and send comments. > > > > http://www.meangrape.com/htmlatex > > BTW, change: > > <Location /your/directory> > PythonPath ['/var/www/python/htmlatex']+sys.path > PythonDebug Off > PythonOutputFilter htmlatex HTMLATEX > AddOutputFilter HTMLATEX .htmlx > </Location> > > > to: > > <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. > > You could also have added it yourself by going: > > if s is None: > temp_doc = ''.join(temp_doc) > data = main(temp_doc) > filter.req.set_content_length(len(data)) > filter.write(data) > filter.close() Hmmm, writing the content length yourself may not work as the following article suggests. http://www.debianhelp.co.uk/apachead.htm Given that the naming of stuff in that example is much like your code, I would hazard to guess though you may have used it as a guide to doing your own. Using the "CONTENT_LENGTH" output filter should work though. Graham
|