[Zope3-dev] Constraints conundrum
Roché Compaan
roche at upfrontsystems.co.za
Thu Jan 8 15:48:32 EST 2004
In my app IOrganisation may contain amongst other things IBranches and
IBranches in turn may contain IOrganisation. I tried to declare a very
relaxed constraint on IBranches and "fix up" the constraint afterwards
but that doesn't work eg.:
class IBranches(Interface):
__setitem__.precondition = ItemTypePrecondition(Interface)
class IOrganisation(Interface):
__setitem__.precondition = ItemTypePrecondition(IBranches)
IBranches.__dict__['_InterfaceClass__attrs']['__setitem__'
] = ItemTypePrecondition(IOrganisation)
When I do the above the security checker moans:
Module zope.security.checker, line 172, in check
raise ForbiddenAttribute, (name, object)
- class: zope.app.container.constraints.ItemTypePrecondition
- type: __builtin__.instance
I can probably make a precondition that takes an Interface name as
parameter and lookup the Interface at runtime, but maybe there is
another way?
--
Roché Compaan
Upfront Systems http://www.upfrontsystems.co.za
More information about the Zope3-dev
mailing list