[Zope-dev] ZPivotTable doesnt save its data dictionary

Jens Vagelpohl jens@digicool.com
Sun, 13 May 2001 09:57:42 -0400


florian,

without even looking at the code, when you use simple data types (lists,
dictionaries, etc) to store your data you have to make sure that the
persistence machinery gets tickled the right way whenever you update values.
with those simple storage datatypes it won't know things have changed unless
you specifically tell it.

you would need to do either something like this::

  self.my_storage_dictionary['newvalue'] = x
  self._p_changed = 1

or you could do it like this:

  dictionary = self.my_storage_dictionary
  dictionary['newvalue'] = x
  self.my_storage_dictionary = dictionary

or you could simply use one of the helper classes that come with zope, like
"PersistentMapping". it emulates a dictionary and makes sure the persistence
machinery gets told about changes.

jens



On 5/12/01 10:27, "florian_reiser@gmx.de" <florian_reiser@gmx.de> wrote:

> Hi folks,
> 
> I've started to program a pivot table.
> 
> Therefore I've created three classes:
> 
> ZPivotTable, Row and Cell.
> 
> The ZPivotTable class contains a set of Row classes, stored in a dictionary,
> as well as the Row classes contain a set of Cell classes stored in a
> dictionary.
> 
> Now I am debugging the product and can't find the reason why the table doesn't
> store the rows in its dictionary.
> 
> Could you please help me finding this bug.
> 
> The source is stored under the following address:
> http://www.zope.org/Members/freiser/ZPivotTable/ZPivotTable-0.0.tar.gz
> 
> Thanks
> 
> Florian Reiser