RE: [Zope-dev] ZClass inheriting from Python Class
-----Original Message----- From: Martijn Faassen [mailto:faassen@vet.uu.nl] Sent: Thursday, July 22, 1999 10:40 AM To: zope-dev@zope.org Subject: Re: [Zope-dev] ZClass inheriting from Python Class
Michel Pelletier wrote:
From: Miller, John M. [mailto:jmiller1@uop.com]
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
You don't really ever need to do this if you treat all attributes immutibly.
So if I use a list attribute in my class to which I append I do need to, right?
Not necesarily, you can do this: list = self.list list.append(blah) ... self.list = list The final assignment will be caught by the persistence machinery and your appends will be saved with it. If you look at the Catalog code, you'll see I did this all over the place and n'er once used commit(). -Michel
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 )
Michel Pelletier wrote:
From: Martijn Faassen [mailto:faassen@vet.uu.nl]
So if I use a list attribute in my class to which I append I do need to, right?
Not necesarily, you can do this:
list = self.list
list.append(blah) ... self.list = list
The final assignment will be caught by the persistence machinery and your appends will be saved with it. If you look at the Catalog code, you'll see I did this all over the place and n'er once used commit().
Ah, useful trick -- code might be faster too due to avoiding variable lookups. Though in some cases commit() may be cleaner. I'll see what works best for me. Thanks! Martijn
Hi Michel, everybody, I just wanted to let you know that everything works fine now. Thanks Michel! Making products is definitely a lot easier with ZClasses, even when Python is used. The Python code can be fairly independent from Zope code -- the only Zopish thing I need to care about (when needed) is persistency. Regards, Martijn
participants (2)
-
Martijn Faassen -
Michel Pelletier