From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id DN33OXBKd2FJcAEAgWs5BA (envelope-from ) for ; Tue, 26 Oct 2021 02:23:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WGoXNXBKd2EZcAAA1q6Kng (envelope-from ) for ; Tue, 26 Oct 2021 00:23:12 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3EB9BA533 for ; Tue, 26 Oct 2021 02:23:12 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 67F3D1F53F; Mon, 25 Oct 2021 20:23:08 -0400 (EDT) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by mail.notmuchmail.org (Postfix) with ESMTPS id 4FFEA1F534 for ; Mon, 25 Oct 2021 20:22:58 -0400 (EDT) Received: by mail-qt1-x835.google.com with SMTP id i1so11959108qtr.6 for ; Mon, 25 Oct 2021 17:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=austinray-io.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9wQpz1sHTExNWO7ef5/tomV8+3u+PlJIXvIoUo9aCKs=; b=24ibeeVdM6udIwImpzICNM3GAYADp9+XLwnkxgGpGAHiB9l/VuMPkf0dt0OO3Fvy6v XRkPjQCr/Nxleoe3vwWhksGE6qYIlBLXE+0o61+ZNV9j+Piyk9x+0RLL9FHKF1RGE7n3 WCQf6WSoAFHV94qDyzeiJ1HdiwsrP3X+IOh56lFp6EemP+HvbAGHS+3GHpVzwPebq+yG 6yQTKBCbGeq+YJSVz8xkezyEfZAtnmCqnJ19bS+DZPNkOVn6Dl0m2/nw802pZQzRoPJZ Yo3EZTfq7M0DAompSo47WKvQqapDn2DrVj4QK0uKh/YAl/9k5H54DWDsE4qScLxTQx+/ PuTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9wQpz1sHTExNWO7ef5/tomV8+3u+PlJIXvIoUo9aCKs=; b=wnm0+294hQoecQWHCzJo0GEWxO8ohdmSDh1V2hpg6j9mK5M1YPrLjkay+vY35QzZHe uWKZGkqxNNKfWiwtYb9fAK7tZZzqhi8GguEcA6CztwUTAI29KvEpT3WA0iSe1MDaySYz QKwRA67UsAcAH6amGyjic7okP4G5Jv07YLt/VfwZaDdjkQS6CjRHZHCyUZGFjvhz3P5e vtSRWUHnAamxAOI5XF1ygt8Ak+3Sn/0yQw0QYfTl9xZ+w1wUiNHLcGtLPJ6Ra2XLgBGZ 0E2HwCXAcHVZOykRxhlPNtg3+VskFL+AMrDZFldeUgJMiIfdPnpm4nI2PEJS0VLJo+d7 FlJA== X-Gm-Message-State: AOAM531pmnHaKyt/Wb+gQXmGbzRNW5r3UU8Ko+v5hMtIuvp33wUAQv/Y iBWFp8UZo/B1CsiMSvqrP4ladXqwYH0= X-Google-Smtp-Source: ABdhPJzCCLFMgPaBrW2dNS8btnvWf0fx9jT4WIF9cyDgz5hRKPz+V/egefV72SlpM9+Wb8opethJNg== X-Received: by 2002:ac8:59d5:: with SMTP id f21mr21759159qtf.296.1635207777012; Mon, 25 Oct 2021 17:22:57 -0700 (PDT) Received: from localhost.localdomain (68-20-11-88.lightspeed.rlghnc.sbcglobal.net. [68.20.11.88]) by smtp.gmail.com with ESMTPSA id b13sm9380805qtq.69.2021.10.25.17.22.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:22:56 -0700 (PDT) From: Austin Ray To: notmuch@notmuchmail.org Subject: [PATCH] fix(nmweb): replace deprecated method Date: Mon, 25 Oct 2021 20:22:52 -0400 Message-Id: <20211026002252.2823593-1-austin@austinray.io> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Message-ID-Hash: HUSZ6HXKRS3IYQKFGLINYMI3ZBX6LRR7 X-Message-ID-Hash: HUSZ6HXKRS3IYQKFGLINYMI3ZBX6LRR7 X-MailFrom: austin@austinray.io X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Austin Ray X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635207792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6NBHt0Bn4JCNNKDei2XLQnsxS3SJgbKz5Z0hp0QjZX0=; b=iRXTrtn+kkU4qVwuZOWhj3uFWUmop/vsJ8m2i/uTTf3KnxKQq5MipTb/Y8CucfYR6J3mL3 LMrwbnR//l9d6YSFFv0+p4dmCDVhIpkMO92Rl+qLxse8THubNNKhDy8vbcGADUvzg6l7kZ g3gEAGHVJYGDpuZPX6izDteoSWJPQH+TdHwkXAfoRfPNGVoeP2RVdTOOazqHc3tUrWhJSb XpBwTOnDRaa8LUayb2ZZg8hVod2UN0G1mpeSn+wzOjVxhJa+Yc5oCOSFRDU9fAAiX5rYde lnugO74su/5pkRivRSbm7omQB4YWEmRt6g5JTszaISS7JVBTrcP2ht6JEgpsGg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635207792; a=rsa-sha256; cv=none; b=lXn4KCVqNgXbxZuIjowOa13u/Mz2GLUrZEVAbXHzEJKVxKtr8FYbfHFaXbUCnQ/iyLvD4z WmliUtSgjPaBiRnKNUdB90Prxuj91lvQGZT/vwb5BBMIpJPBLZ/+M9NWuDXf5baio2UBC2 kMvWqgzU3zShI3y6yrsQGYUSOcXIDUfrIjbSCtdqRDyZ0XIG4os1ox4upVUkfJdAyqWtZY Q2A0Q0GSC6H8Wvdv/VykvH0/u2OASt++h8aWFbu91dD1XBbG4guuV7/eRXPI2TVK2dJP07 EXRiepqMyTnjB/1jTKVxU3gg5mMi6DoMl64UqCayxrL/FXLX0DHfG/IaXP5+fQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=austinray-io.20210112.gappssmtp.com header.s=20210112 header.b=24ibeeVd; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 0.04 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=austinray-io.20210112.gappssmtp.com header.s=20210112 header.b=24ibeeVd; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 3EB9BA533 X-Spam-Score: 0.04 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0T3NxRykpeC8 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 --- 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 '
'
         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