[Zope] Non-persistent ZClasses?
Dieter Maurer
dieter@handshake.de
Fri, 24 Jan 2003 00:12:55 +0100
John Coleman wrote at 2003-1-21 17:06 -0500:
> I am trying to create non-persistent ZClasses.
Their main purpose is to be used as "brain"s in Z SQL Methods
(--> Advanced tab). Then they are created automatically.
When you want to create them yourself, you can do it like this:
<yourZInstance>= <someObjectManager>.manage_addProduct[<yourProduct>]<yourZClass>()
However, you will probably can use only methods usable by
"Anonymous", even when you are "Manager".
The reason: the ZInstance created in the above way is not put
into the acquisition context. Therefore, the security
machinery is unable to find the default role mapping (located
in the Website's root) through acquisition.
To fix this, you must use an External Method that wraps
the Z Instance into a context:
def wrap(ZInstance,context):
return ZInstance.__of__(context)
"context" must be some acquisition wrapped object (able to
reach the Website's root).
Dieter