From owner-svn-ports-head@freebsd.org Fri Jun 5 06:23:56 2020 Return-Path: Delivered-To: svn-ports-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 910B3341ABF; Fri, 5 Jun 2020 06:23:56 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49dXfN3NS4z4BTR; Fri, 5 Jun 2020 06:23:56 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F621C7B8; Fri, 5 Jun 2020 06:23:56 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0556NuOv042562; Fri, 5 Jun 2020 06:23:56 GMT (envelope-from jbeich@FreeBSD.org) Received: (from jbeich@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0556NuqB042561; Fri, 5 Jun 2020 06:23:56 GMT (envelope-from jbeich@FreeBSD.org) Message-Id: <202006050623.0556NuqB042561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jbeich set sender to jbeich@FreeBSD.org using -f From: Jan Beich Date: Fri, 5 Jun 2020 06:23:56 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r537989 - in head/www/py-cherrypy: . files X-SVN-Group: ports-head X-SVN-Commit-Author: jbeich X-SVN-Commit-Paths: in head/www/py-cherrypy: . files X-SVN-Commit-Revision: 537989 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2020 06:23:56 -0000 Author: jbeich Date: Fri Jun 5 06:23:55 2020 New Revision: 537989 URL: https://svnweb.freebsd.org/changeset/ports/537989 Log: www/py-cherrypy: unbreak with DEFAULT_VERSIONS += python=3.8 >>> import cherrypy Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.8/site-packages/cherrypy/__init__.py", line 67, in from cherrypy._cperror import HTTPError, HTTPRedirect, InternalRedirect File "/usr/local/lib/python3.8/site-packages/cherrypy/_cperror.py", line 118, in from cgi import escape as _escape ImportError: cannot import name 'escape' from 'cgi' (/usr/local/lib/python3.8/cgi.py) Obtained from: upstream Added: head/www/py-cherrypy/files/ head/www/py-cherrypy/files/patch-html (contents, props changed) Modified: head/www/py-cherrypy/Makefile (contents, props changed) Modified: head/www/py-cherrypy/Makefile ============================================================================== --- head/www/py-cherrypy/Makefile Fri Jun 5 06:11:48 2020 (r537988) +++ head/www/py-cherrypy/Makefile Fri Jun 5 06:23:55 2020 (r537989) @@ -3,7 +3,7 @@ PORTNAME= cherrypy PORTVERSION= 5.4.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= www python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} Added: head/www/py-cherrypy/files/patch-html ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/py-cherrypy/files/patch-html Fri Jun 5 06:23:55 2020 (r537989) @@ -0,0 +1,60 @@ +https://github.com/cherrypy/cherrypy/commit/c65dc279d1d8 + +--- cherrypy/_cpcompat.py.orig 2016-05-11 00:35:35 UTC ++++ cherrypy/_cpcompat.py +@@ -357,3 +357,19 @@ class SetDaemonProperty: + + if sys.version_info < (2, 6): + daemon = property(__get_daemon, __set_daemon) ++ ++# html module come in 3.2 version ++try: ++ from html import escape ++except ImportError: ++ from cgi import escape ++ ++# html module needed the argument quote=False because in cgi the default ++# is False. With quote=True the results differ. ++ ++def escape_html(s, escape_quote=False): ++ """Replace special characters "&", "<" and ">" to HTML-safe sequences. ++ ++ When escape_quote=True, escape (') and (") chars. ++ """ ++ return escape(s, quote=escape_quote) +--- cherrypy/_cperror.py.orig 2016-05-11 00:35:35 UTC ++++ cherrypy/_cperror.py +@@ -115,9 +115,9 @@ Note that you have to explicitly set + and not simply return an error message as a result. + """ + +-from cgi import escape as _escape + from sys import exc_info as _exc_info + from traceback import format_exception as _format_exception ++from cherrypy._cpcompat import escape_html + from cherrypy._cpcompat import basestring, bytestr, iteritems, ntob + from cherrypy._cpcompat import tonative, urljoin as _urljoin + from cherrypy.lib import httputil as _httputil +@@ -489,7 +489,7 @@ def get_error_page(status, **kwargs): + if v is None: + kwargs[k] = "" + else: +- kwargs[k] = _escape(kwargs[k]) ++ kwargs[k] = escape_html(kwargs[k]) + + # Use a custom template or callable for the error page? + pages = cherrypy.serving.request.error_page +--- cherrypy/test/test_compat.py.orig 2016-05-11 00:35:35 UTC ++++ cherrypy/test/test_compat.py +@@ -17,3 +17,11 @@ class StringTester(unittest.TestCase): + if compat.py3k: + raise nose.SkipTest("Only useful on Python 2") + self.assertRaises(Exception, compat.ntob, unicode('fight')) ++ ++ ++class EscapeTester(unittest.TestCase): ++ """Class to test escape_html function from _cpcompat.""" ++ ++ def test_escape_quote(self): ++ """test_escape_quote - Verify the output for &<>"' chars.""" ++ self.assertEqual("""xx&<>"aa'""", compat.escape_html("""xx&<>"aa'"""))