Hello, I hav a python product that I'm working on which contains a content class which uses OOBtrees and OOSets internally for storing structured data. The problem is that changes to this object which involve those structures do not seem to be undoable (i.e. no transaction shows up in the manage_undo or manage_change_history_page of the instance or its parent). I've tried explicity using get_transaction() to commit and annotate the transaction, and the note seems to end up in the Data.fs, but the transaction still does not appear. Are those datatypes not subject to transactions in the usual manner? Is there a way around this? Should I just use dictionaries and _p_changed if I want to track revisions? Thanks in advance for any enlightenment on these issues. Alec Mitchell
Alec Mitchell wrote at 2004-1-9 15:52 -0800:
I hav a python product that I'm working on which contains a content class which uses OOBtrees and OOSets internally for storing structured data. The problem is that changes to this object which involve those structures do not seem to be undoable (i.e. no transaction shows up in the manage_undo or manage_change_history_page of the instance or its parent). I've tried explicity using get_transaction() to commit and annotate the transaction, and the note seems to end up in the Data.fs, but the transaction still does not appear. Are those datatypes not subject to transactions in the usual manner?
Not that I know of. Or stricter: I am quite sure that they use transactions in the usual manner. However, Zope's "undo" is easily fooled. A transaction is associated with "PUBLISHED.getPhysicalPath()", independent of which objects is modifies. This may imply that you do not see an "undo" record at the place where you expect it. However, you should see it at the "Root Folder" level. -- Dieter
On Saturday 10 January 2004 12:22 pm, Dieter Maurer wrote:
Not that I know of. Or stricter:
I am quite sure that they use transactions in the usual manner.
However, Zope's "undo" is easily fooled. A transaction is associated with "PUBLISHED.getPhysicalPath()", independent of which objects is modifies. This may imply that you do not see an "undo" record at the place where you expect it. However, you should see it at the "Root Folder" level.
Yes, it is there! Thank you. I had looked a few folders back from the instance but not at the root. That's great. Is there any way to get the transaction associated with the proper object? I tried the method listed in a recent zopelabs.com recipe: get_transaction().note('/'.join(foo.getPhysicalPath())) To no avail (though it didn't make much sense to me to begin with). If this is not directly possible, where can I find more information about delving into the transaction machinery to find the transactions specific to this object? My web and mailing list searches have been pretty fruitless, and the source code for the transaction machinery is pretty opaque to me. Thanks again. Alec Mitchell
Alec Mitchell wrote at 2004-1-10 20:47 -0800:
... Is there any way to get the transaction associated with the proper object? I tried the method listed in a recent zopelabs.com recipe:
get_transaction().note('/'.join(foo.getPhysicalPath()))
The "Undo" machinery uses the first information in "Transaction.description". "Transaction.note" appends to this field. This means, it is unable to change information already there (as it the case for the object). You can make an external method that changes "description" directly or call "get_transaction().commit()" (this commits the old transaction and opens a new one) and then call "get_transaction().notr(...)". Note that it may be dangerous to have two commits in one request (in case the request is repeated due to "ConflictError"s). -- Dieter
On Sat, Jan 10, 2004 at 08:47:00PM -0800, Alec Mitchell wrote:
On Saturday 10 January 2004 12:22 pm, Dieter Maurer wrote:
Not that I know of. Or stricter:
I am quite sure that they use transactions in the usual manner.
However, Zope's "undo" is easily fooled. A transaction is associated with "PUBLISHED.getPhysicalPath()", independent of which objects is modifies. This may imply that you do not see an "undo" record at the place where you expect it. However, you should see it at the "Root Folder" level.
Yes, it is there! Thank you. I had looked a few folders back from the instance but not at the root. That's great. Is there any way to get the transaction associated with the proper object? I tried the method listed in a recent zopelabs.com recipe:
get_transaction().note('/'.join(foo.getPhysicalPath()))
I posted that recipe, and I don't pretend to really understand how it works ;-) I read a bit of ZODB source, discovered the "note" method, and fiddled around until I came up with the above which seems to work for me. I would appreciate improvements, corrections etc: http://www.zopelabs.com/cookbook/1072135864 -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's SUPER MERRY DISHWASHER INVADER! (random hero from isometric.spaceninja.com)
participants (3)
-
Alec Mitchell -
Dieter Maurer -
Paul Winkler