#!/usr/bin/env python
import coral
import traceback


def observer(x):
    n_commands = 0
    tr = coral.getTransactionManager().getCurrentTransaction()
    for c in tr:
        n_commands += 1
        if n_commands == 1:
            coral.lang.UML14.Class(0)
    
    print "n_commands:", n_commands        
    assert n_commands == 2

coral.lang.UML14

tm = coral.getTransactionManager()
tm.addObserver(observer)

tm.beginModifyCmd()
try:
    d = coral.PresentationElement(0)
finally:
    tm.endModifyCmd()
