[Zope] Re: Values lost when restarting

Tres Seaver tseaver at palladion.com
Tue Jan 9 11:11:20 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonas Nielsen wrote:
> Hi this is probably a little vague but any help is appreciated.
> 
> I'm developing on an old zope application, which I ported from zope 
> 2.5.1 to zope 2.9. The application seems like it's based on the 
> addressbook application in the "Zope Bible"
> 
> The application is a tool for localization, where translators can log in 
> and edit "translation resources" in "resource folders"
> 
> I made a function to export all these resources to a csv-file and one to 
> import the values in the zodb again.
> 
> the text are set using a function on the resource calling
>    	
> def setText(self,language,text, REQUEST=None):
>        # ... some stuff
>        self.texts[language] = text
> 
> The function works fine and updates the values correctly. But after I 
> restart zope all the changes are lost. This not so when calling the 
> function from the Resource objects web form.
> 
> The "Zope Bible" says something about calling self.__changed__(1) after 
> updating the value but this doesn't seem to work even though the objects 
> inherits from "Persistent"
> 
> When importing I fetch the object by using the RestrictedTraverse 
> function, that's really the only difference I can see.
> 
> Please write if you have ANY idea of what could be the problem.

You are mutating the 'texts' attribute of your object, which is likely a
dict.  Try making it either a PersistentMapping or an OOBTree, each of
which know about persisting their changes.


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFo76o+gerLs4ltQ4RAutYAJ9p4rTjHk2LggRbp+91e2p6/EempgCfQeMV
PS5GYcat4hON8DSEBX46Dbk=
=19gP
-----END PGP SIGNATURE-----



More information about the Zope mailing list