From: Austin Ray <austin@austinray.io>
To: notmuch@notmuchmail.org
Cc: Austin Ray <austin@austinray.io>
Subject: [PATCH] fix(nmweb): replace deprecated method
Date: Mon, 25 Oct 2021 20:22:52 -0400 [thread overview]
Message-ID: <20211026002252.2823593-1-austin@austinray.io> (raw)
Python 3.2 deprecated 'cgi.escape()' and Python 3.8 removed it[1][2].
Its replacement is 'html.escape()'.
[0] https://docs.python.org/3.7/library/cgi.html#cgi.escape
[1] https://docs.python.org/3/whatsnew/3.8.html#api-and-feature-removals
[2] https://bugs.python.org/issue33843
Signed-off-by: Austin Ray <austin@austinray.io>
---
contrib/notmuch-web/nmweb.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/contrib/notmuch-web/nmweb.py b/contrib/notmuch-web/nmweb.py
index 9e337436..0754a502 100755
--- a/contrib/notmuch-web/nmweb.py
+++ b/contrib/notmuch-web/nmweb.py
@@ -14,7 +14,7 @@ from mailbox import MaildirMessage
import mimetypes
import email
import re
-import cgi
+import html
import os
import bleach
@@ -265,7 +265,7 @@ def format_message_walk(msg, mid):
yield '<pre>'
out = part.get_payload(decode=True)
out = decodeAnyway(out, part.get_content_charset('ascii'))
- out = cgi.escape(out)
+ out = html.escape(out)
out = out.encode('ascii', 'xmlcharrefreplace').decode('ascii')
if linkify_plaintext: out = bleach.linkify(out, callbacks=[require_protocol_prefix])
yield out
--
2.32.0
next reply other threads:[~2021-10-26 0:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 0:22 Austin Ray [this message]
2021-10-26 1:15 ` [PATCH] fix(nmweb): replace deprecated method David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211026002252.2823593-1-austin@austinray.io \
--to=austin@austinray.io \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).