objects not updated after restart of Zope
Hi, I have a product, and I make a change of it's attributes. Bellow's a method & DTML snippet, how I do this. Object is updated, everything works fine until I restart Zope - changes are lost afterwords, and objects get previous content of "title" and "text" attributes. it seems to me that object is changed, cached in memory, but not stored into Data.fs. any idea what could be wrong ? regards, Michal my product: def editData(self, title, text, category = 1, REQUEST=None): """Edit""" self.title = title self.text = text self.category = category self._p_changed = 1 dtml/edit.dtml: <dtml-call "editData(atitle, atext, REQUEST=REQUEST)">
"Michal" == Michal Bencur <zope@benko.sk> writes:
Michal> Object is updated, everything works fine until I restart Michal> Zope - changes are lost afterwords, and objects get Michal> previous content of "title" and "text" attributes. Michal> it seems to me that object is changed, cached in memory, Michal> but not stored into Data.fs. Michal> any idea what could be wrong ? You need to either derive from Globals.Persistent or some class that does this for you, like OFS.SimpleItem, which will give you most of the stock behaviors that you desire for, well, simple items. You may want to check out the maxm product tutorials: http://www.zope.org/Members/maxm/HowTo/minimal_01 http://www.zope.org/Members/maxm/HowTo/minimal_02 Cheers, John Hunter
I can create instances of my product, I can change the properties of existing instances, but when I restart Zope all these changes are gone. I inherit from all these: class MyProduct(PropertyManager, RoleManager, Item, Implicit, FindSupport): """...""" On Mon, May 13, 2002 at 09:39:46AM -0500, John Hunter wrote:
You need to either derive from Globals.Persistent or some class that does this for you, like OFS.SimpleItem, which will give you most of the stock behaviors that you desire for, well, simple items.
You may want to check out the maxm product tutorials:
http://www.zope.org/Members/maxm/HowTo/minimal_01 http://www.zope.org/Members/maxm/HowTo/minimal_02
Cheers, John Hunter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
"Michal" == Michal Bencur <zope@benko.sk> writes:
Michal> I inherit from all these: Michal> class MyProduct(PropertyManager, RoleManager, Item, Michal> Implicit, FindSupport): """...""" That appears to be your problem. SimpleItem, but not Item, derives from Globals.Persistent. It also derives from RoleManager and Implicit, so you will probably have success with: class MyProduct(SimpleItem, PropertyManager, FindSupport)
thanks a lot John for your help, it works now, but I had to remove all of my existing product instances, because it did not work on them ... regards, Michal On Mon, May 13, 2002 at 10:05:14AM -0500, John Hunter wrote:
"Michal" == Michal Bencur <zope@benko.sk> writes:
Michal> I inherit from all these:
Michal> class MyProduct(PropertyManager, RoleManager, Item, Michal> Implicit, FindSupport): """..."""
That appears to be your problem. SimpleItem, but not Item, derives from Globals.Persistent. It also derives from RoleManager and Implicit, so you will probably have success with:
class MyProduct(SimpleItem, PropertyManager, FindSupport)
participants (2)
-
John Hunter -
Michal Bencur