hgweb: wrap {fentries} and {dentries} of manifest with mappinggenerator
authorYuya Nishihara <yuya@tcha.org>
Wed, 04 Apr 2018 20:14:19 +0900
changeset 38062 17f7b44367bb
parent 38061 d3b4c4769b5c
child 38063 3c995af3066e
hgweb: wrap {fentries} and {dentries} of manifest with mappinggenerator They were functions returning a generator of mappings.
mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Apr 04 20:11:20 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Wed Apr 04 20:14:19 2018 +0900
@@ -556,7 +556,7 @@
     if mf and not files and not dirs:
         raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)
 
-    def filelist(**map):
+    def filelist(context):
         for f in sorted(files):
             full = files[f]
 
@@ -568,7 +568,7 @@
                    "size": fctx.size(),
                    "permissions": mf.flags(full)}
 
-    def dirlist(**map):
+    def dirlist(context):
         for d in sorted(dirs):
 
             emptydirs = []
@@ -591,8 +591,8 @@
         path=abspath,
         up=webutil.up(abspath),
         upparity=next(parity),
-        fentries=filelist,
-        dentries=dirlist,
+        fentries=templateutil.mappinggenerator(filelist),
+        dentries=templateutil.mappinggenerator(dirlist),
         archives=web.archivelist(hex(node)),
         **pycompat.strkwargs(webutil.commonentry(web.repo, ctx)))