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/metadirectives.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/metadirectives.py')
-rw-r--r-- | src/zope/security/metadirectives.py | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/zope/security/metadirectives.py b/src/zope/security/metadirectives.py index a080372..1a81658 100644 --- a/src/zope/security/metadirectives.py +++ b/src/zope/security/metadirectives.py @@ -25,7 +25,6 @@ from zope.interface import Interface import zope.security.zcml from zope.security.i18n import ZopeMessageFactory as _ from zope.security.zcml import Permission -from zope.security._compat import _u class IClassDirective(zope.interface.Interface): """Make statements about a class""" @@ -149,8 +148,8 @@ class IModule(Interface): """Group security declarations about a module""" module = GlobalObject( - title=_u("Module"), - description=_u("Pointer to the module object."), + title=u"Module", + description=u"Pointer to the module object.", required=True) @@ -163,17 +162,17 @@ class IAllow(Interface): """ attributes = Tokens( - title=_u("Attributes"), - description=_u("The attributes to provide access to."), - value_type = PythonIdentifier(), + title=u"Attributes", + description=u"The attributes to provide access to.", + value_type=PythonIdentifier(), required=False) interface = Tokens( - title=_u("Interface"), - description=_u("Interfaces whos names to provide access to. Access " - "will be provided to all of the names defined by the " - "interface(s). Multiple interfaces can be supplied."), - value_type = GlobalInterface(), + title=u"Interface", + description=(u"Interfaces whos names to provide access to. Access " + u"will be provided to all of the names defined by the " + u"interface(s). Multiple interfaces can be supplied."), + value_type=GlobalInterface(), required=False) @@ -182,15 +181,15 @@ class IRequire(Interface): The given permission is required to access any names provided directly in the attributes attribute or any names defined by - interfaces listed in the interface attribute. + interfaces listed in the interface attribute. """ attributes = Tokens( - title=_u("Attributes"), - description=_u("The attributes to require permission for."), - value_type = PythonIdentifier(), + title=u"Attributes", + description=u"The attributes to require permission for.", + value_type=PythonIdentifier(), required=False) permission = Permission( - title=_u("Permission ID"), - description=_u("The id of the permission to require.")) + title=u"Permission ID", + description=u"The id of the permission to require.") |