← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging ~cjwatson/launchpad:html-escape into launchpad:master.

Commit message:
Use html.escape directly

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/411231
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:html-escape into launchpad:master.
diff --git a/lib/lp/services/compat.py b/lib/lp/services/compat.py
index f5ebfe2..d364a4e 100644
--- a/lib/lp/services/compat.py
+++ b/lib/lp/services/compat.py
@@ -7,15 +7,9 @@ Use this for things that six doesn't provide.
 """
 
 __all__ = [
-    'escape',
     'message_as_bytes',
     ]
 
-try:
-    from html import escape
-except ImportError:
-    from cgi import escape
-
 import io
 
 
diff --git a/lib/lp/testing/keyserver/web.py b/lib/lp/testing/keyserver/web.py
index 871ea7e..c2eb26d 100644
--- a/lib/lp/testing/keyserver/web.py
+++ b/lib/lp/testing/keyserver/web.py
@@ -31,13 +31,13 @@ __all__ = [
     ]
 
 import glob
+import html
 import os
 from time import sleep
 
 from twisted.web.resource import Resource
 from zope.component import getUtility
 
-from lp.services.compat import escape
 from lp.services.gpg.interfaces import (
     GPGKeyNotFoundError,
     IGPGHandler,
@@ -145,7 +145,7 @@ class LookUp(Resource):
         path = locate_key(self.root, filename)
         if path is not None:
             with open(path) as f:
-                content = escape(f.read(), quote=False)
+                content = html.escape(f.read(), quote=False)
             page = ('<html>\n<head>\n'
                     '<title>Results for Key %s</title>\n'
                     '</head>\n<body>'