Skip to content

Commit b0746a4

Browse files
Replace removed cgi.escape with html.escape. (ros-infrastructure#321)
1 parent 3c47c71 commit b0746a4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ on:
99
jobs:
1010
build:
1111
name: run rep tests
12-
runs-on: ubuntu-18.04
12+
runs-on: ubuntu-20.04
1313

1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: Set up Python ${{matrix.python}}
1717
uses: actions/setup-python@v1
1818
with:
19-
python-version: 3.6
19+
python-version: 3.8
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install docutils xmlschema

rep2html.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import sys
4040
import os
4141
import re
42-
import cgi
42+
import html
4343
import glob
4444
import getopt
4545
import errno
@@ -124,8 +124,8 @@ def fixanchor(current, match):
124124
rfcnum = int(match.group('rfcnum'))
125125
link = RFCURL % rfcnum
126126
if link:
127-
return '<a href="%s">%s</a>' % (cgi.escape(link), cgi.escape(text))
128-
return cgi.escape(match.group(0)) # really slow, but it works...
127+
return '<a href="%s">%s</a>' % (html.escape(link), html.escape(text))
128+
return html.escape(match.group(0)) # really slow, but it works...
129129

130130

131131
NON_MASKED_EMAILS = [
@@ -246,18 +246,18 @@ def fixfile(inpath, input_lines, outfile):
246246
time.localtime(os.stat(inpath)[8]))
247247
try:
248248
url = REPGITURL % int(rep)
249-
v = '<a href="%s">%s</a> ' % (url, cgi.escape(date))
249+
v = '<a href="%s">%s</a> ' % (url, html.escape(date))
250250
except ValueError as error:
251251
v = date
252252
elif k.lower() in ('content-type',):
253253
url = REPURL % 9
254254
rep_type = v or 'text/plain'
255-
v = '<a href="%s">%s</a> ' % (url, cgi.escape(rep_type))
255+
v = '<a href="%s">%s</a> ' % (url, html.escape(rep_type))
256256
else:
257-
v = cgi.escape(v)
257+
v = html.escape(v)
258258
print((' <tr class="field"><th class="field-name">%s:&nbsp;</th>' +
259259
'<td class="field-body">%s</td></tr>') %
260-
(cgi.escape(k), v), file=outfile)
260+
(html.escape(k), v), file=outfile)
261261
print('</table>', file=outfile)
262262
print('</div>', file=outfile)
263263
print('<hr />', file=outfile)

0 commit comments

Comments
 (0)