[ZODB-Dev] Transaction

Paolo Invernizzi paoloinvernizzi at dmsware.com
Tue Jul 15 12:17:04 EDT 2003


Maybe a stupid question...

I'm implementing some python script for managing some 
files...(creation,move,changes,etc...).

I'm wondering if is it possible manage this functions transactionally.

What is the best way to handle that?

For example...

class MyFile(Persistent):
     def work(self):
        # for example ... copy file1.data __file1.data
        # work on __file1.data based on self datas...


     def on_commit(self):
         # do something on the file when committing
         # copy __file1.data over file1.data
         # del __file1.data

     def on_rollback(self):
         # the transaction was aborted.
         del __file1.data

If I have some MyFile instances, is it possible to have 
on_commit/on_rollback called when committing or aborting a transaction?

---
Paolo Invernizzi





More information about the ZODB-Dev mailing list