Related Entries

Interview with Ploners
Formulator makes life easy
Server side python
Resetting Zope's session timeout
Plone roles on

« Security hole or stupidity?
» Who will clean up the mess?

Getting undo history

Printing out transaction log in Zope.

Something funny was going on with a Zope installation I am interested in. I wanted to eliminate the "human error" factor :-) Like everything in Zope, it is pretty easy if you are brave enough to look at the source.

If you know Zope, you might already be familiar with the Undo tab. I wanted to get the information from that Undo log to a flat file periodically, before the database is automatically packed by other scheduled jobs.

A very simple Python script - let me call this undo_log at the root level did the job.


for u in context.undoable_transactions(first_transaction=0, last_transaction=5000):
    print "%s|%s|%s" % (u['description'], u['user_name'], u['time'])
return printed
#it is unlikely that I’ll have more than 5000 transactions per day

I simply do a lynx -dump http://myzopeserver/undo_log | load_to_sqlite.sh where load_to_sqlite.sh is a small script to add data to a sqlite database. Doing this for a week and then analysing the data should give me enough information :-)

This is a silly script, but hey, it took me 10 minutes to find out the proper function and to write. So, if you are looking for similar stuff, may be this becomes useful.

  1. I think this has something to do with A little worm...

    man.. you disabled html

    Posted by: zope boy on March 25, 2003 11:18 PM
  2. Yes indeed, *A* little worm :-)

    Posted by: Babu on March 26, 2003 05:25 AM
  3. Hello,
    Do you know how to get the ID of the objects
    made by Archetype from undoable_transactions??
    (Archetype: type generator product)

    I can not.
    For exsample,
    The ID is 'QTFYWHJxZ1pDeUk9 2004/06/17 16:42:39.398 GMT+9 /demosite/base_edit'.
    But the object's instance id is 'sample_document' edited by 'base_edit' form within 'demosite'.
    I'd like to get the id, 'sample_document'

    Best regards..
    Help!!

    Posted by: ShintaroHara on June 17, 2004 03:54 PM
//-->