From c0807b6ca629731510ae41ccbcab27570d687546 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Thu, 7 Sep 2017 17:52:15 -0500 Subject: Simplify _compat.py now that we only run on newer Pythons - We have u'literals' so we don't need a _u() function. For the record the Emacs replacement regex was `_u(\(['"]\)\([^)]*\)\1) -> u\1\2\1`. Amazingly, I typed that right on the first try. A few things were only used in one (test) file or function, so it was better to keep the use, if any, local and out of the "public" api: - We can use io.StringIO everywhere and it's fast. It was only imported in one file anyway. - We can just import pickle. It was only imported in one file anyway. - TEXT was only used in one test function, `type(u'')` is just as clear (especially since the usual name is `text_type`). - reload was only used in one test function, so move the definition there. --- src/zope/security/tests/test_proxy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/zope/security/tests/test_proxy.py') diff --git a/src/zope/security/tests/test_proxy.py b/src/zope/security/tests/test_proxy.py index ca4a8a3..62d6a83 100644 --- a/src/zope/security/tests/test_proxy.py +++ b/src/zope/security/tests/test_proxy.py @@ -1957,7 +1957,11 @@ class LocationProxySecurityCheckerTests(unittest.TestCase): import sys from zope.location.location import LocationProxy import zope.security - from zope.security._compat import reload + try: + from imp import reload + except ImportError: + reload = reload # Python 2 + # This attribute is set when zope.security.decorator is imported, to # show that it will be set too, if zope.security.proxy is imported # we set it to a different value at first: -- cgit v1.2.1