Skip to content

Commit

Permalink
Replace removed cgi.escape with html.escape. (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearsandwich authored May 19, 2021
1 parent 3c47c71 commit b0746a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
jobs:
build:
name: run rep tests
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{matrix.python}}
uses: actions/setup-python@v1
with:
python-version: 3.6
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install docutils xmlschema
Expand Down
14 changes: 7 additions & 7 deletions rep2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import sys
import os
import re
import cgi
import html
import glob
import getopt
import errno
Expand Down Expand Up @@ -124,8 +124,8 @@ def fixanchor(current, match):
rfcnum = int(match.group('rfcnum'))
link = RFCURL % rfcnum
if link:
return '<a href="%s">%s</a>' % (cgi.escape(link), cgi.escape(text))
return cgi.escape(match.group(0)) # really slow, but it works...
return '<a href="%s">%s</a>' % (html.escape(link), html.escape(text))
return html.escape(match.group(0)) # really slow, but it works...


NON_MASKED_EMAILS = [
Expand Down Expand Up @@ -246,18 +246,18 @@ def fixfile(inpath, input_lines, outfile):
time.localtime(os.stat(inpath)[8]))
try:
url = REPGITURL % int(rep)
v = '<a href="%s">%s</a> ' % (url, cgi.escape(date))
v = '<a href="%s">%s</a> ' % (url, html.escape(date))
except ValueError as error:
v = date
elif k.lower() in ('content-type',):
url = REPURL % 9
rep_type = v or 'text/plain'
v = '<a href="%s">%s</a> ' % (url, cgi.escape(rep_type))
v = '<a href="%s">%s</a> ' % (url, html.escape(rep_type))
else:
v = cgi.escape(v)
v = html.escape(v)
print((' <tr class="field"><th class="field-name">%s:&nbsp;</th>' +
'<td class="field-body">%s</td></tr>') %
(cgi.escape(k), v), file=outfile)
(html.escape(k), v), file=outfile)
print('</table>', file=outfile)
print('</div>', file=outfile)
print('<hr />', file=outfile)
Expand Down

0 comments on commit b0746a4

Please sign in to comment.