diff options
| author | Jason Madden <jamadden@gmail.com> | 2017-09-07 17:52:15 -0500 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2017-09-07 17:52:15 -0500 |
| commit | c0807b6ca629731510ae41ccbcab27570d687546 (patch) | |
| tree | ce768e8ec100e65869e924dbe896ee367e86f056 /src/zope/security/permission.py | |
| parent | f2de4625c116085404958724468899dbe784bce6 (diff) | |
| download | zope-security-remove_u.tar.gz | |
Simplify _compat.py now that we only run on newer Pythonsremove_u
- 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.
Diffstat (limited to 'src/zope/security/permission.py')
| -rw-r--r-- | src/zope/security/permission.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/zope/security/permission.py b/src/zope/security/permission.py index efacde9..8044d4d 100644 --- a/src/zope/security/permission.py +++ b/src/zope/security/permission.py @@ -27,7 +27,6 @@ from zope.schema.vocabulary import SimpleVocabulary from zope.security.checker import CheckerPublic from zope.security.interfaces import IPermission -from zope.security._compat import _u @implementer(IPermission) class Permission(object): @@ -49,7 +48,7 @@ def allPermissions(context=None): """Get the ids of all defined permissions """ for id, permission in getUtilitiesFor(IPermission, context): - if id != _u('zope.Public'): + if id != u'zope.Public': yield id def PermissionsVocabulary(context=None): @@ -85,7 +84,7 @@ def PermissionIdsVocabulary(context=None): terms.append(SimpleTerm(name, name, name)) terms = sorted(terms, key=operator.attrgetter('title')) if has_public: - terms.insert(0, SimpleTerm(CheckerPublic, 'zope.Public', _u('Public'))) + terms.insert(0, SimpleTerm(CheckerPublic, 'zope.Public', u'Public')) return SimpleVocabulary(terms) directlyProvides(PermissionIdsVocabulary, IVocabularyFactory) |
