[Zope] Undo problem

Pascal Peregrina Pperegrina at Lastminute.com
Thu Jan 13 17:09:38 EST 2005


One last thing I noticed :
Although when displaying B PersistentMapping content I can see A changes,
the undo tab of B says there is nothing to undo (while the undo tab of A
says I can undo whatever property change I did to it).

B class is declared as extending : UniqueObject, SimpleItem, Persistent

Pascal

-----Message d'origine-----
De : Pascal Peregrina 
Envoyé : jeudi 13 janvier 2005 23:06
À : 'dieter at handshake.de'
Cc : 'zope at zope.org'
Objet : RE: [Zope] Undo problem


Ok, I am using Zope 2.7.3, which includes ZODB 3.2.4

In the code below, I am not doing any transaction handling by myself.
When I modify A properties, the call to the B method (that modifies B
PersistentMapping) is made from the method of A that actually modidies A
pesistent data.

So why wouldn't A and B object changes be part of the same transaction ?
Is there any explicit code to make sure to remain in a single transaction ?

Thanks.

Pascal


-----Message d'origine-----
De : Dieter Maurer [mailto:dieter at handshake.de]
Envoyé : jeudi 13 janvier 2005 22:34
À : Pascal Peregrina
Cc : 'zope at zope.org'
Objet : Re: [Zope] Undo problem


Pascal Peregrina wrote at 2005-1-13 17:00 +0100:
> ... 2 objects A and B modified in same transaction ...
>Unfortunately, when I undo a change on A (using undo tab in ZMI),
>information is not removed from B.
>
>Can someone tell me what I did wrong ?

When the change to A and B happens in the same transaction,
then the undo must revert both changes. If it does not, you
hit a bug.

Note that in older Zope versions, invalidation messages
were not sent correctly for "undo" (from ZEO).
This was fixed with ZODB 3.2.

-- 
Dieter

-----Message d'origine-----
De : zope-bounces at zope.org [mailto:zope-bounces at zope.org]De la part de
Pascal Peregrina
Envoyé : jeudi 13 janvier 2005 17:00
À : 'zope at zope.org'
Objet : [Zope] Undo problem


Hi,

I have made 2 Zope products.

One of them is a content object that extends PropertyManager.
The  :
+ _update_property
+ _set_property
+ _del_property
methods have been redefined to add a call to my 2nd product, in order to
notify it about the changes.

--- code excerpt ---
def  _del_property(self,id):
 <call to the PropertyManager method>
 try:
  getToolByName(self,'change_tracker').manage_addChange(<params>)
 except:
  pass
-----

I created an object A of this type.

The 2nd product is a tool with a simple PersistentMapping() that store these
changes information.

--- code excerpt ---
def manage_addChange(self,<params>):
	...
	self._changes[<somekey>]=<somevalue> # self._changes is the
PersistentMapping
	self._changes=self._changes #to be sure PersistentMapping is updated
in ZODB
	...
-----

I created an object B of this type.

When I modify properties on A, I get the information added to B.
So I thought eveything was working fine.

Unfortunately, when I undo a change on A (using undo tab in ZMI),
information is not removed from B.

Can someone tell me what I did wrong ?

Thanks a lot.

Pascal


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



More information about the Zope mailing list