Source: haproxy
Version: 2.0.13-1
Severity: important
Dear Maintainer,
can you please move cgi method into the http one?
Line `2685' exceeds 80 columns
Parsing chapter ...
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/debian/dconv/haproxy-dconv.py", line 536, in <module>
main()
File "/<<PKGBUILDDIR>>/debian/dconv/haproxy-dconv.py", line 69, in main
convert(option.infile, option.outfile, option.base)
File "/<<PKGBUILDDIR>>/debian/dconv/haproxy-dconv.py", line 360, in convert
content = cgi.escape(content, True)
AttributeError: module 'cgi' has no attribute 'escape'
make[1]: *** [debian/rules:61: override_dh_auto_build-indep] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
In python 3.8 looks like cgi.escape has been removed.
https://launchpadlibrarian.net/465183911/buildlog_ubuntu-focal-amd64.haproxy_2.0.13-1ubuntu1_BUILDING.txt.gz
Fortunately html.escape seems to be a drop-in replacement for it, so the
following patch fixes the issue:
http://launchpadlibrarian.net/465185230/haproxy_2.0.13-1ubuntu1_2.0.13-1ubuntu2.diff.gz
diff -Nru haproxy-2.0.13/debian/dconv/haproxy-dconv.py
haproxy-2.0.13/debian/dconv/haproxy-dconv.py
--- haproxy-2.0.13/debian/dconv/haproxy-dconv.py 2020-02-15
21:48:40.000000000 +0000
+++ haproxy-2.0.13/debian/dconv/haproxy-dconv.py 2020-02-16
09:34:53.000000000 +0000
@@ -23,7 +23,7 @@
import os
import subprocess
import sys
-import cgi
+import html
import re
import time
import datetime
@@ -338,7 +338,7 @@
documentAppend('<a class="anchor" id="%s" name="%s"></a>' %
(details["chapter"], details["chapter"]))
if level == 1:
documentAppend("<div class=\"page-header\">", False)
- documentAppend('<h%d id="chapter-%s" data-target="%s"><small><a
class="small" href="#%s">%s.</a></small> %s</h%d>' % (level,
details["chapter"], details["chapter"], details["chapter"], details["chapter"],
cgi.escape(title, True), level))
+ documentAppend('<h%d id="chapter-%s" data-target="%s"><small><a
class="small" href="#%s">%s.</a></small> %s</h%d>' % (level,
details["chapter"], details["chapter"], details["chapter"], details["chapter"],
html.escape(title, True), level))
if level == 1:
documentAppend("</div>", False)
@@ -353,7 +353,7 @@
if index < len(chapterIndexes) - 1:
documentAppend('<li class="next"><a
href="#%s">Next</a></li>' % chapterIndexes[index + 1], False)
documentAppend('</ul>', False)
- content = cgi.escape(content, True)
+ content = html.escape(content, True)
content = re.sub(r'section ([0-9]+(.[0-9]+)*)', r'<a
href="#\1">section \1</a>', content)
pctxt.set_content(content)