Merge ~cjwatson/launchpad:html-escape into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 26ccde1cfc1039310b9693ba7fd230e8273b3762
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:html-escape
Merge into: launchpad:master
Diff against target: 48 lines (+2/-8)
2 files modified
lib/lp/services/compat.py (+0/-6)
lib/lp/testing/keyserver/web.py (+2/-2)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+411231@code.launchpad.net

Commit message

Use html.escape directly

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/compat.py b/lib/lp/services/compat.py
2index f5ebfe2..d364a4e 100644
3--- a/lib/lp/services/compat.py
4+++ b/lib/lp/services/compat.py
5@@ -7,15 +7,9 @@ Use this for things that six doesn't provide.
6 """
7
8 __all__ = [
9- 'escape',
10 'message_as_bytes',
11 ]
12
13-try:
14- from html import escape
15-except ImportError:
16- from cgi import escape
17-
18 import io
19
20
21diff --git a/lib/lp/testing/keyserver/web.py b/lib/lp/testing/keyserver/web.py
22index 871ea7e..c2eb26d 100644
23--- a/lib/lp/testing/keyserver/web.py
24+++ b/lib/lp/testing/keyserver/web.py
25@@ -31,13 +31,13 @@ __all__ = [
26 ]
27
28 import glob
29+import html
30 import os
31 from time import sleep
32
33 from twisted.web.resource import Resource
34 from zope.component import getUtility
35
36-from lp.services.compat import escape
37 from lp.services.gpg.interfaces import (
38 GPGKeyNotFoundError,
39 IGPGHandler,
40@@ -145,7 +145,7 @@ class LookUp(Resource):
41 path = locate_key(self.root, filename)
42 if path is not None:
43 with open(path) as f:
44- content = escape(f.read(), quote=False)
45+ content = html.escape(f.read(), quote=False)
46 page = ('<html>\n<head>\n'
47 '<title>Results for Key %s</title>\n'
48 '</head>\n<body>'

Subscribers

People subscribed via source and target branches

to status/vote changes: