diff mercurial/hgweb/webcommands.py @ 34695:e178fcaa3933

python3: use our bytes-only version of cgi.escape everywhere As suggested by Yuya in D965. Differential Revision: https://phab.mercurial-scm.org/D1067
author Augie Fackler <augie@google.com>
date Thu, 05 Oct 2017 14:16:20 -0400
parents 4182d2065e7a
children 3a65012be661
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sat Oct 14 02:57:26 2017 -0400
+++ b/mercurial/hgweb/webcommands.py	Thu Oct 05 14:16:20 2017 -0400
@@ -7,7 +7,6 @@
 
 from __future__ import absolute_import
 
-import cgi
 import copy
 import mimetypes
 import os
@@ -38,6 +37,7 @@
     smartset,
     templatefilters,
     templater,
+    url,
     util,
 )
 
@@ -1250,9 +1250,9 @@
             node = str(ctx)
             age = encodestr(templatefilters.age(ctx.date()))
             desc = templatefilters.firstline(encodestr(ctx.description()))
-            desc = cgi.escape(templatefilters.nonempty(desc))
-            user = cgi.escape(templatefilters.person(encodestr(ctx.user())))
-            branch = cgi.escape(encodestr(ctx.branch()))
+            desc = url.escape(templatefilters.nonempty(desc))
+            user = url.escape(templatefilters.person(encodestr(ctx.user())))
+            branch = url.escape(encodestr(ctx.branch()))
             try:
                 branchnode = web.repo.branchtip(branch)
             except error.RepoLookupError:
@@ -1261,8 +1261,8 @@
 
             if usetuples:
                 data.append((node, vtx, edges, desc, user, age, branch,
-                             [cgi.escape(encodestr(x)) for x in ctx.tags()],
-                             [cgi.escape(encodestr(x))
+                             [url.escape(encodestr(x)) for x in ctx.tags()],
+                             [url.escape(encodestr(x))
                               for x in ctx.bookmarks()]))
             else:
                 edgedata = [{'col': edge[0], 'nextcol': edge[1],