[Checkins] [zopefoundation/zope.security] c0807b: Simplify _compat.py now that we only run on newer ...

GitHub noreply at github.com
Fri Sep 8 00:57:47 CEST 2017


  Branch: refs/heads/remove_u
  Home:   https://github.com/zopefoundation/zope.security
  Commit: c0807b6ca629731510ae41ccbcab27570d687546
      https://github.com/zopefoundation/zope.security/commit/c0807b6ca629731510ae41ccbcab27570d687546
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2017-09-07 (Thu, 07 Sep 2017)

  Changed paths:
    M src/zope/security/_compat.py
    M src/zope/security/_definitions.py
    M src/zope/security/checker.py
    M src/zope/security/metadirectives.py
    M src/zope/security/permission.py
    M src/zope/security/tests/test_checker.py
    M src/zope/security/tests/test_management.py
    M src/zope/security/tests/test_metaconfigure.py
    M src/zope/security/tests/test_proxy.py
    M src/zope/security/tests/test_zcml_functest.py
    M src/zope/security/zcml.py

  Log Message:
  -----------
  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.




More information about the checkins mailing list