summaryrefslogtreecommitdiff
path: root/src/zope/security/interfaces.py
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2017-11-30 11:47:28 -0600
committerJason Madden <jamadden@gmail.com>2017-11-30 11:47:28 -0600
commitab429edc94e3d6db26ff398672c716982a5d64c0 (patch)
treed0fb07f95cfed0f1b7437dbe35cec3435929831c /src/zope/security/interfaces.py
parent4844db9ddcc539be3d5ff31a884621e0e258c075 (diff)
downloadzope-security-issue48.tar.gz
Fix default values for Permission's title and description in Py2issue48
And test this. This applies to both the class and the ZCML directive. Also adjust IPermission to use NativeStringLine for ``id``, since that's what ZCML has always been creating (it uses an Id, which subclasses NativeStringLine), and what's typically written in source code. Test that the permissions created from ZCML are valid with this change.
Diffstat (limited to 'src/zope/security/interfaces.py')
-rw-r--r--src/zope/security/interfaces.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/zope/security/interfaces.py b/src/zope/security/interfaces.py
index 4c62bdc..1d646ee 100644
--- a/src/zope/security/interfaces.py
+++ b/src/zope/security/interfaces.py
@@ -52,7 +52,7 @@ means the name of the permission, or the special object
from zope.interface import Interface, Attribute, implementer
from zope.interface.common.interfaces import IException, IAttributeError
-from zope.schema import Text, TextLine
+from zope.schema import Text, TextLine, NativeStringLine
from zope.security.i18n import ZopeMessageFactory as _
#: The name (id) of the registered :class:`IPermission` utility that signifies
@@ -438,9 +438,14 @@ class IMemberAwareGroup(IMemberGetterGroup):
"""
class IPermission(Interface):
- """A permission object."""
+ """A permission object.
- id = TextLine(
+ Note that the ZCML ``<permission>`` directive restricts the ``id`` to
+ be an identifier (a dotted name or a URI), but this interface allows
+ any native string.
+ """
+
+ id = NativeStringLine(
title=_("Id"),
description=_("Id as which this permission will be known and used."),
readonly=True,