unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] fix(nmweb): replace deprecated method
@ 2021-10-26  0:22 Austin Ray
  2021-10-26  1:15 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: Austin Ray @ 2021-10-26  0:22 UTC (permalink / raw)
  To: notmuch; +Cc: Austin Ray

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix(nmweb): replace deprecated method
  2021-10-26  0:22 [PATCH] fix(nmweb): replace deprecated method Austin Ray
@ 2021-10-26  1:15 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2021-10-26  1:15 UTC (permalink / raw)
  To: Austin Ray, notmuch; +Cc: Austin Ray

Austin Ray <austin@austinray.io> writes:

> 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>

Applied to branch nmweb.

Thanks very much for the fast fix.

David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-26  1:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26  0:22 [PATCH] fix(nmweb): replace deprecated method Austin Ray
2021-10-26  1:15 ` David Bremner

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).