diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2020-02-19 10:55:41 (GMT) |
---|---|---|
committer | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2020-02-19 10:55:46 (GMT) |
commit | 4d744de3eed19af8c8c1094637a044747c297934 (patch) | |
tree | 05c09c5edd274bc2513969e7a319fff9fe4ae930 /src/browse.py | |
parent | 9fd5d3e00bac970dcdb15010a7eef381c4a44c14 (diff) | |
download | Ninja-4d744de3eed19af8c8c1094637a044747c297934.zip Ninja-4d744de3eed19af8c8c1094637a044747c297934.tar.gz Ninja-4d744de3eed19af8c8c1094637a044747c297934.tar.bz2 |
browse.py: use html.escape for python3
fixes #1741
fixes #1736
Diffstat (limited to 'src/browse.py')
-rwxr-xr-x | src/browse.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/browse.py b/src/browse.py index 1c9c39b..653cbe9 100755 --- a/src/browse.py +++ b/src/browse.py @@ -29,12 +29,15 @@ except ImportError: import BaseHTTPServer as httpserver import SocketServer as socketserver import argparse -import cgi import os import socket import subprocess import sys import webbrowser +if sys.version_info >= (3, 2): + from html import escape +else: + from cgi import escape try: from urllib.request import unquote except ImportError: @@ -62,7 +65,7 @@ def match_strip(line, prefix): return (True, line[len(prefix):]) def html_escape(text): - return cgi.escape(text, quote=True) + return escape(text, quote=True) def parse(text): lines = iter(text.split('\n')) |