Show More
@@ -650,7 +650,16 b' class hgweb(object):' | |||||
650 | raise Exception("suspicious path") |
|
650 | raise Exception("suspicious path") | |
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.": | |||
|
655 | raise RuntimeError("This function is only intended to be called while running as a CGI script.") | |||
|
656 | import mercurial.hgweb.wsgicgi as wsgicgi | |||
|
657 | from request import wsgiapplication | |||
|
658 | def make_web_app(): | |||
|
659 | return self.__class__(self.repo, self.reponame) | |||
|
660 | wsgicgi.launch(wsgiapplication(make_web_app)) | |||
|
661 | ||||
|
662 | def run_wsgi(self, req): | |||
654 | def header(**map): |
|
663 | def header(**map): | |
655 | header_file = cStringIO.StringIO(''.join(self.t("header", **map))) |
|
664 | header_file = cStringIO.StringIO(''.join(self.t("header", **map))) | |
656 | msg = mimetools.Message(header_file, 0) |
|
665 | msg = mimetools.Message(header_file, 0) |
@@ -20,6 +20,7 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 | |||
23 | self.motd = "" |
|
24 | self.motd = "" | |
24 | self.repos_sorted = ('name', False) |
|
25 | self.repos_sorted = ('name', False) | |
25 | if isinstance(config, (list, tuple)): |
|
26 | if isinstance(config, (list, tuple)): | |
@@ -46,7 +47,16 b' class hgwebdir(object):' | |||||
46 | self.repos.append((name.lstrip(os.sep), repo)) |
|
47 | self.repos.append((name.lstrip(os.sep), repo)) | |
47 | self.repos.sort() |
|
48 | self.repos.sort() | |
48 |
|
49 | |||
49 |
def run(self |
|
50 | def run(self): | |
|
51 | if os.environ['GATEWAY_INTERFACE'][0:6] != "CGI/1.": | |||
|
52 | raise RuntimeError("This function is only intended to be called while running as a CGI script.") | |||
|
53 | import mercurial.hgweb.wsgicgi as wsgicgi | |||
|
54 | from request import wsgiapplication | |||
|
55 | def make_web_app(): | |||
|
56 | return self.__class__(self.origconfig) | |||
|
57 | wsgicgi.launch(wsgiapplication(make_web_app)) | |||
|
58 | ||||
|
59 | def run_wsgi(self, req): | |||
50 | def header(**map): |
|
60 | def header(**map): | |
51 | header_file = cStringIO.StringIO(''.join(tmpl("header", **map))) |
|
61 | header_file = cStringIO.StringIO(''.join(tmpl("header", **map))) | |
52 | msg = mimetools.Message(header_file, 0) |
|
62 | msg = mimetools.Message(header_file, 0) |
@@ -48,7 +48,7 b' class _wsgirequest(object):' | |||||
48 | self.form = cgi.parse(self.inp, self.env, keep_blank_values=1) |
|
48 | self.form = cgi.parse(self.inp, self.env, keep_blank_values=1) | |
49 | self.start_response = start_response |
|
49 | self.start_response = start_response | |
50 | self.headers = [] |
|
50 | self.headers = [] | |
51 | destination.run(self) |
|
51 | destination.run_wsgi(self) | |
52 |
|
52 | |||
53 | def __iter__(self): |
|
53 | def __iter__(self): | |
54 | return iter([]) |
|
54 | return iter([]) |
@@ -202,7 +202,7 b' def fill(text, width):' | |||||
202 | if para_re is None: |
|
202 | if para_re is None: | |
203 | para_re = re.compile('(\n\n|\n\\s*[-*]\\s*)', re.M) |
|
203 | para_re = re.compile('(\n\n|\n\\s*[-*]\\s*)', re.M) | |
204 | space_re = re.compile(r' +') |
|
204 | space_re = re.compile(r' +') | |
205 |
|
205 | |||
206 | def findparas(): |
|
206 | def findparas(): | |
207 | start = 0 |
|
207 | start = 0 | |
208 | while True: |
|
208 | while True: |
General Comments 0
You need to be logged in to leave comments.
Login now