[Zope-CMF] context-sensitive undo form

Sam Brauer sam@webslingerz.com
Fri, 27 Jun 2003 10:36:03 -0400


Tres Seaver wrote:
> On Fri, 2003-06-27 at 09:28, Sam Brauer wrote:
> 
>>By default, the undo_form shows all transactions (that the user can 
>>undo) for the whole CMF site.  It would be nice if it instead showed 
>>only the transactions for the current object that the user is working 
>>with.  (In the case of a folderish object, I suppose you might want to 
>>see all of the transactions recursively under that folder.)  I tried 
>>hitting a url like:  http://mycmfsite.org/someobject/undo_form thinking 
>>that it would do what I wanted, but that still produces a list of all 
>>transactions for the whole site.
>>
>>Has anyone customized the undo_form to list transactions in a 
>>context-sensitive manner?  Or can someone offer hints about how that 
>>might be done?
> 
> 
> This can't be done in the general case, because the ZODB doesn't
> maintain enough metadata about the transaction to allow it.  The only
> metadata it knows is the physical path of the *method* which drove the
> transaction;  because of skinning, the method always has the CMFSite
> object as its aq_parent, rather than the (?) content object (since some
> transactions touch multiple objects, even that would be iffy were it
> possible).
> 
> Tres.


Tres,

Thanks for the explanation.  Since "context-sensitive undo" isn't a 
possiblity, I wonder if it would be possible to add a little more info 
to the transaction history, such as the URI that triggered the transaction.

As it is, everytime someone edits a document (for instance) there's a 
transaction like this:

/mysite/document_edit  by   mysite sam   Zope    on June 26 at 15:34:53

It doesn't mention which document was edited, only that some document 
was edited.

But if I edited /mysite/someobject (by submitting the edit form to 
http://127.0.0.1:8080/mysite/someobject/document_edit), it would be 
nicer to see:

/mysite/someobject/document_edit  by   mysite sam   Zope    on June 26 
at 15:34:53

 From the little that I currently know about Zope transactions, that 
first string is the "description".  So I guess what I want to be able to 
do is control what the description is for each transaction performed in 
the CMFSite.  I can dig around and try to figure that out.  Of course, 
any tips would be much appreciated :)

-- 
Sam Brauer
Systems Programmer
sam@webslingerZ.com