Skip to content

Commit

Permalink
replacing cgi escape with html escape due to problems with python > 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Pengfei Ding committed Jan 30, 2021
1 parent 19abe52 commit a174fdf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libpip2pi/commands.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import re
import sys
import cgi
import shutil
import atexit
import tempfile
Expand All @@ -13,6 +12,11 @@
import glob
import optparse

try:
from html import escape
except ImportError:
from cgi import escape

try:
import wheel as _; _
has_wheel = True
Expand Down Expand Up @@ -374,15 +378,15 @@ def _dir2pi(option, argv):

if pkg_name not in processed_pkg:
pkg_index += "<a href='%s/'>%s</a><br />\n" %(
cgi.escape(pkg_dir_name),
cgi.escape(pkg_name),
escape(pkg_dir_name),
escape(pkg_name),
)
processed_pkg.add(pkg_name)

if option.build_html:
with open(os.path.join(pkg_dir, "index.html"), "a") as fp:
fp.write("<a href='%(name)s'>%(name)s</a><br />\n" %{
"name": cgi.escape(pkg_basename),
"name": escape(pkg_basename),
})
pkg_index += "</body></html>\n"

Expand Down

0 comments on commit a174fdf

Please sign in to comment.