Mercurial > hg
changeset 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 | 2976cf87a60a |
children | 15b561fffde5 |
files | mercurial/hgweb/webcommands.py mercurial/minirst.py mercurial/templatefilters.py |
diffstat | 3 files changed, 10 insertions(+), 10 deletions(-) [+] |
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],
--- a/mercurial/minirst.py Sat Oct 14 02:57:26 2017 -0400 +++ b/mercurial/minirst.py Thu Oct 05 14:16:20 2017 -0400 @@ -20,13 +20,13 @@ from __future__ import absolute_import -import cgi import re from .i18n import _ from . import ( encoding, pycompat, + url, util, ) @@ -552,7 +552,7 @@ listnest = [] def escape(s): - return cgi.escape(s, True) + return url.escape(s, True) def openlist(start, level): if not listnest or listnest[-1][0] != start:
--- a/mercurial/templatefilters.py Sat Oct 14 02:57:26 2017 -0400 +++ b/mercurial/templatefilters.py Thu Oct 05 14:16:20 2017 -0400 @@ -7,7 +7,6 @@ from __future__ import absolute_import -import cgi import os import re import time @@ -19,6 +18,7 @@ pycompat, registrar, templatekw, + url, util, ) @@ -128,7 +128,7 @@ """Any text. Replaces the special XML/XHTML characters "&", "<" and ">" with XML entities, and filters out NUL characters. """ - return cgi.escape(text.replace('\0', ''), True) + return url.escape(text.replace('\0', ''), True) para_re = None space_re = None