No way to inherit permissions of built-in types in subtypes.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Triaged
|
Low
|
Unassigned |
Bug Description
Subclasses of frozenset don't appear to be magically granted those
permissions given to frozenset, and there doesn't seem to be a
ready-made interface for frozenset that I could inherit from. (There
is IFrozenSet in zope.schema but it's an IField subclass.)
The frozenset checker can be obtained by calling:
from zope.security import checker
checker = checker.
It defines permissions for the following names:
__and__ __contains__ __eq__ __ge__ __gt__ __iter__ __le__ __len__
__lt__ __ne__ __or__ __rand__ __ror__ __rsub__ __rxor__ __str__
__sub__ __xor__ copy difference intersection issubset issuperset
symmetric_
I could define an interface for this and use it when declaring
permissions on my subtype, or when defining the interface for my
subtype. This seems... wrong, but would work okay. I suppose I could
write a test to ensure that the interface definition keeps up-to-date
with the names defined in Zope's default frozenset checker.
Anyway, without this interface, writing ZCML becomes tedious. For now
I've opted for registering custom checkers (see lp_sitecustomize for
some other jiggery pokery in the same vein) while I seek a better
solution.
Here's my hack:
from zope.security import checker
checker_
checker_
checker_
["sorted", "subscribers"])
checker.
(
checker.
(
checker.
(
Changed in launchpad: | |
status: | New → Triaged |
importance: | Undecided → Low |
tags: | added: zope |