[ZODB-Dev] [Zope-DB] Getting transaction ID of get_transaction().commit()?

Andreas Jung andreas at andreas-jung.com
Thu Aug 7 11:02:30 EDT 2003



--On Dienstag, 5. August 2003 11:26 Uhr +0100 Chris Withers 
<chrisw at nipltd.com> wrote:

> Andreas Jung wrote:
>> Any ideas how to handle this?
>
> Sadly not, but just to say that I'd love to know how to do this too...
>

Here is a solution for my own Undo management:

- the persistent class gets an attribute self.transaction=[]

- for every important user action I append a tuple (time.time(), "user 
did...")
   to self.transactions and I add a transaction note:
   get_transaction().note('user did...(TS:<timestamp>)')

  So I have the timestamp as unique ID inside the transaction note and 
inside
  my own list of important transaction

- for my own undo screen I can display the informations from 
self.transactions

- to find the correspondig transaction ID one must walk through
   self.undoable_transaction(), check every transaction dict for the 
corresponding
   timestamp and get the transaction ID.

Not a nice solution but it works perfectly.

-aj




More information about the ZODB-Dev mailing list