##// END OF EJS Templates
Cleanup hgweb and hgwebdir's run method a bit.
Eric Hopper -
r2538:f4b7d71c default
parent child Browse files
Show More
@@ -651,12 +651,12 b' class hgweb(object):'
651 return p
651 return p
652
652
653 def run(self):
653 def run(self):
654 if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.":
654 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
655 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
655 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
656 import mercurial.hgweb.wsgicgi as wsgicgi
656 import mercurial.hgweb.wsgicgi as wsgicgi
657 from request import wsgiapplication
657 from request import wsgiapplication
658 def make_web_app():
658 def make_web_app():
659 return self.__class__(self.repo, self.reponame)
659 return self
660 wsgicgi.launch(wsgiapplication(make_web_app))
660 wsgicgi.launch(wsgiapplication(make_web_app))
661
661
662 def run_wsgi(self, req):
662 def run_wsgi(self, req):
@@ -20,7 +20,6 b' class hgwebdir(object):'
20 def cleannames(items):
20 def cleannames(items):
21 return [(name.strip(os.sep), path) for name, path in items]
21 return [(name.strip(os.sep), path) for name, path in items]
22
22
23 self.origconfig = config
24 self.motd = ""
23 self.motd = ""
25 self.repos_sorted = ('name', False)
24 self.repos_sorted = ('name', False)
26 if isinstance(config, (list, tuple)):
25 if isinstance(config, (list, tuple)):
@@ -48,12 +47,12 b' class hgwebdir(object):'
48 self.repos.sort()
47 self.repos.sort()
49
48
50 def run(self):
49 def run(self):
51 if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.":
50 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):
52 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
51 raise RuntimeError("This function is only intended to be called while running as a CGI script.")
53 import mercurial.hgweb.wsgicgi as wsgicgi
52 import mercurial.hgweb.wsgicgi as wsgicgi
54 from request import wsgiapplication
53 from request import wsgiapplication
55 def make_web_app():
54 def make_web_app():
56 return self.__class__(self.origconfig)
55 return self
57 wsgicgi.launch(wsgiapplication(make_web_app))
56 wsgicgi.launch(wsgiapplication(make_web_app))
58
57
59 def run_wsgi(self, req):
58 def run_wsgi(self, req):
General Comments 0
You need to be logged in to leave comments. Login now