hgwebdir with mod_python

Dirkjan Ochtman dirkjan at ochtman.nl
Mon May 21 23:23:15 UTC 2007


Dirkjan Ochtman wrote:
> Given this function, it should also be easy to use the newer mod_wsgi 
> Apache module, available from code.google.com/p/modwsgi.

Here is my code for hg.wsgi, which can be used with mod_wsgi:

from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import _wsgirequest

class WSGIApplication(object):

         def __call__(self, environ, start_response):
		hwd = hgwebdir('/var/hg/hg.config')
                 return _wsgirequest(hwd, environ, start_response)

application = WSGIApplication()

Unfortunately, there's a problem with a Content-Length header being 
submitted for static files. This was fixed in 4038:5ae460b1f6f0 on 
selenic.com/hg, but it's not in hg-stable, for example. Maybe it can be 
pulled over to stable? Also, it would be very nice if there was a more 
recent release with little fixes like this one.

Regards,

Dirkjan




More information about the Mercurial mailing list