[Zope-dev] ZClass inheriting from Python Class

Michel Pelletier michel@digicool.com
Thu, 22 Jul 1999 10:55:45 -0400


> -----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 )
>