RE: [Zope-dev] ZClass inheriting from Python Class
Heya, If I've read and interpreted the Documentation properly, you need to make your Python class a subclass of BoboPOS.Persistent. Then I think you need to do something like get_transaction().commit() when you want to commit changes you've made. Though it may be that Zope takes care of transactions most of the time and you don't have to worry about this. I also just discovered a 27 page document on ZODB 3 (cool! the more stuff to read, the better I say) which definitely will have a more definitive answer than my casual hack. ZODB-ly yours, (pronounced zodebely, rhymes with notably, of course) John
-----Original Message----- From: Martijn Faassen [SMTP:faassen@vet.uu.nl] Sent: Thursday, July 22, 1999 4:18 AM To: zope-dev@zope.org Subject: [Zope-dev] ZClass inheriting from Python Class
Hi everybody,
I've been toying with ZClasses. I made a simple Python class and registered it with Zope as mentioned in the ZClass tutorial. Then I made a ZClass that inherits from this Python class. I store some text data in a list in the ZClass.
This works fine, except when I restart Zope; the data in the list is gone. Apparently the mixin Python class is not automatically persistent. Is this what should happen? What do I do about it?
Regards,
Martijn
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://www.zope.org/mailman/listinfo/zope-dev
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For non-developer, user-level issues, zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
"Miller, John M." wrote:
If I've read and interpreted the Documentation properly, you need to make your Python class a subclass of BoboPOS.Persistent. Then I think you need to do something like get_transaction().commit() when you want to commit changes you've made. Though it may be that Zope takes care of transactions most of the time and you don't have to worry about this.
Yes, but in the case of ZClasses I was assuming that my Python mixin class would be automagically mixed in with the ZClass, which already does all this persistent stuff, right? So that's why I'm puzzled, but maybe you're right. In that case I want to know why still. :) I'm probably just confused about this, but the ZClasses tutorial also doesn't mention having to do more than registering the Python class with Zope to make it work.
I also just discovered a 27 page document on ZODB 3 (cool! the more stuff to read, the better I say) which definitely will have a more definitive answer than my casual hack.
If I don't get any answers I'll try that; though I thought ZClasses weren't part of ZOBD 3 itself, but something on top of it instead. Regards, Martijn
participants (2)
-
Martijn Faassen -
Miller, John M.