I am trying to create non-persistent ZClasses. I have seen no examples of this anywhere in the online Zope realm, but I have seen several references to "non-persistent wrapper classes," but no one seems to be able to provide an example. I could be going about my project incorrectly, but this really seems to be the best approach. Is anyone out there familiar with creating these and can give me some examples of constructors (python preferred, but will take whatever you have at this point!) and adding instances programmatically? Thanks, -- John Coleman jcoleman@sbc.edu -- Rev 13:16-17, translated for the information age: http://www.passport.com --
Zope brings persistence to Python and Zclasses are Zope classes so they are always persistent. That's a newbie point of view. John Coleman a écrit:
I am trying to create non-persistent ZClasses. I have seen no examples of this anywhere in the online Zope realm, but I have seen several references to "non-persistent wrapper classes," but no one seems to be able to provide an example. I could be going about my project incorrectly, but this really seems to be the best approach.
Is anyone out there familiar with creating these and can give me some examples of constructors (python preferred, but will take whatever you have at this point!) and adding instances programmatically?
Thanks,
-- Andre PZP Enthusiast
On Tue, Jan 21, 2003 at 06:52:01PM -0400, D2 wrote:
Zope brings persistence to Python and Zclasses are Zope classes so they are always persistent. That's a newbie point of view.
And it's wrong. :) Classes in zope are only persistent if they inherit from Globals.Persistent directly or indirectly. As for ZClasses, I don't know anything about working with them. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's FAKER SLUDGE! (courtesy of isometric.spaceninja.com)
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
participants (4)
-
D2 -
Dieter Maurer -
John Coleman -
Paul Winkler