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.
--On 9. Januar 2007 17:06:24 +0100 Jonas Nielsen <jonasn@mail.tele.dk> wrote:
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"
self._p_changed = 1 -aj
On Tue, 2007-01-09 at 17:09 +0100, Andreas Jung wrote:
--On 9. Januar 2007 17:06:24 +0100 Jonas Nielsen <jonasn@mail.tele.dk> wrote:
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"
self._p_changed = 1
Well, I suppose that's the final nail in the coffin for the Zope Bible (like it actually *needed* another one at this point). I think the self.__changed__(1) spelling I used was deprecated even before I wrote the book, and I guess the supporting code must have been taken out of the ZODB since then. So, just shoot me and go pre-order Philipp's book now: http://www.amazon.com/exec/obidos/ASIN/3540338071/fiawol/ref=nosim Cheers all, - Michael R. Bernstein michaelbernstein.com
-----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@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-----
participants (4)
-
Andreas Jung -
Jonas Nielsen -
Michael Bernstein -
Tres Seaver