comparison mercurial/hgweb/hgwebdir_mod.py @ 2506:d0db3462d568

This patch make several WSGI related alterations. First, it changes the server to be almost a generic WSGI server. Second, it changes request.py to have wsgiapplication and _wsgirequest. wsgiapplication is a class that creates _wsgirequests when called by a WSGI compliant server. It needs to know whether or not it should create hgwebdir or hgweb requests. Lastly, wsgicgi.py is added, and the CGI scripts are altered to use it to launch wsgiapplications in a WSGI compliant way. As a side effect, all the keepalive code has been removed from request.py. This code needs to be moved so that it is exclusively in server.py
author Eric Hopper <hopper@omnifarious.org>
date Tue, 27 Jun 2006 00:09:33 -0700
parents d351a3be3371
children 6350b01d173f
comparison
equal deleted inserted replaced
2505:01b856927970 2506:d0db3462d568
9 import os 9 import os
10 from mercurial.demandload import demandload 10 from mercurial.demandload import demandload
11 demandload(globals(), "ConfigParser") 11 demandload(globals(), "ConfigParser")
12 demandload(globals(), "mercurial:ui,hg,util,templater") 12 demandload(globals(), "mercurial:ui,hg,util,templater")
13 demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb") 13 demandload(globals(), "mercurial.hgweb.hgweb_mod:hgweb")
14 demandload(globals(), "mercurial.hgweb.request:hgrequest")
15 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile") 14 demandload(globals(), "mercurial.hgweb.common:get_mtime,staticfile")
16 from mercurial.i18n import gettext as _ 15 from mercurial.i18n import gettext as _
17 16
18 # This is a stopgap 17 # This is a stopgap
19 class hgwebdir(object): 18 class hgwebdir(object):
45 if name.startswith(prefix): 44 if name.startswith(prefix):
46 name = name[len(prefix):] 45 name = name[len(prefix):]
47 self.repos.append((name.lstrip(os.sep), repo)) 46 self.repos.append((name.lstrip(os.sep), repo))
48 self.repos.sort() 47 self.repos.sort()
49 48
50 def run(self, req=hgrequest()): 49 def run(self, req):
51 def header(**map): 50 def header(**map):
52 yield tmpl("header", **map) 51 yield tmpl("header", **map)
53 52
54 def footer(**map): 53 def footer(**map):
55 yield tmpl("footer", motd=self.motd, **map) 54 yield tmpl("footer", motd=self.motd, **map)