This revision was automatically updated to reflect the committed changes.
Closed by commit rHG93717f082af9: hgweb: use modern response type for index
generation (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D2827?vs=6893=6957
REVISION DETAIL
https://phab.mercurial-scm.org/D2827
AFFECTED FILES
mercurial/hgweb/hgwebdir_mod.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -16,7 +16,6 @@
from .common import (
ErrorResponse,
HTTP_NOT_FOUND,
-HTTP_OK,
HTTP_SERVER_ERROR,
cspvalues,
get_contact,
@@ -400,16 +399,14 @@
repos = dict(self.repos)
if (not virtual or virtual == 'index') and virtual not in repos:
-wsgireq.respond(HTTP_OK, ctype)
-return self.makeindex(req, tmpl)
+return self.makeindex(req, res, tmpl)
# nested indexes and hgwebs
if virtual.endswith('/index') and virtual not in repos:
subdir = virtual[:-len('index')]
if any(r.startswith(subdir) for r in repos):
-wsgireq.respond(HTTP_OK, ctype)
-return self.makeindex(req, tmpl, subdir)
+return self.makeindex(req, res, tmpl, subdir)
def _virtualdirs():
# Check the full virtual path, each parent, and the root ('')
@@ -442,8 +439,7 @@
# browse subdirectories
subdir = virtual + '/'
if [r for r in repos if r.startswith(subdir)]:
-wsgireq.respond(HTTP_OK, ctype)
-return self.makeindex(req, tmpl, subdir)
+return self.makeindex(req, res, tmpl, subdir)
# prefixes not found
wsgireq.respond(HTTP_NOT_FOUND, ctype)
@@ -455,7 +451,7 @@
finally:
tmpl = None
-def makeindex(self, req, tmpl, subdir=""):
+def makeindex(self, req, res, tmpl, subdir=""):
self.refresh()
sortable = ["name", "description", "contact", "lastchange"]
sortcolumn, descending = None, False
@@ -478,10 +474,16 @@
self.stripecount, sortcolumn=sortcolumn,
descending=descending, subdir=subdir)
-return tmpl("index", entries=entries, subdir=subdir,
-pathdef=hgweb_mod.makebreadcrumb('/' + subdir,
self.prefix),
-sortcolumn=sortcolumn, descending=descending,
-**dict(sort))
+res.setbodygen(tmpl(
+'index',
+entries=entries,
+subdir=subdir,
+pathdef=hgweb_mod.makebreadcrumb('/' + subdir, self.prefix),
+sortcolumn=sortcolumn,
+descending=descending,
+**dict(sort)))
+
+return res.sendresponse()
def templater(self, wsgireq, nonce):
To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel