[Zope-dev] New Counter Product

Scott Robertson sroberts@codeit.com
Thu, 25 Mar 1999 11:43:57 -0800 (PST)


On Wed, 24 Mar 1999, Shaw, Howard wrote:

> Well, it is basically finished and working, combining a visible Product
> interface and a counter tag... But, overriding __setstate__, removing
> the temporary entry from the state, and called Persistent.__setstate__,
> while generating no errors, fails to prevent the temporary entry from
> being written into the database.  Please help, I need two answers!
> 
> 1. How can I create a variable within a Product that will not be
> persistent (i.e. will not be written to disk)?
> 
> 2. What function is called at normal shutdown? I need to call a function
> at shutdown to move the current value from temp to real.
> 
> Note: The counter is usable as is, so if the list members think that
> Paul's now repudiated fear of constant disk growth is a non-issue, I
> could drop the temporary variable, and just keep the advantages of the
> interface, and the potential for an SQL based backend whilst keeping the
> same front-end.
> 

I'm not sure if this will help but...
I've noticed mutable objects (lists, dictionsries) don't change you need
to call self.__changed__(1) whenever you add or edit an object to a list
or dictionary. Makes me wonder what would happen if you call
self.__changed__(0) at the end of your request.