#NEWLINE# def getCurrentOperationDict( actions , currentOperations = None ) : #NEWLINE# #INDENT# if ( currentOperations is None ) : #NEWLINE# #INDENT# currentOperations = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# for action in actions : #NEWLINE# #INDENT# for operation in action . db_operations : #NEWLINE# #INDENT# operationvtType = operation . vtType #NEWLINE# d = operation . __dict__ #NEWLINE# if ( operationvtType == 'add' ) : #NEWLINE# #INDENT# currentOperations [ ( d [ '_db_what' ] , d [ '_db_objectId' ] ) ] = operation #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( operationvtType == 'delete' ) : #NEWLINE# #INDENT# what = d [ '_db_what' ] #NEWLINE# objectId = d [ '_db_objectId' ] #NEWLINE# t = ( what , objectId ) #NEWLINE# try : #NEWLINE# #INDENT# del currentOperations [ t ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# msg = ( 'Illegal delete operation: %d' % d [ '_db_id' ] ) #NEWLINE# raise RuntimeError ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( operationvtType == 'change' ) : #NEWLINE# #INDENT# what = what [ '_db_what' ] #NEWLINE# objectId = d [ '_db_oldObjId' ] #NEWLINE# t = ( what , objectId ) #NEWLINE# try : #NEWLINE# #INDENT# del currentOperations [ t ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# msg = ( 'Illegal change operation: %d' % d [ '_db_id' ] ) #NEWLINE# raise RuntimeError ( msg ) #NEWLINE# #UNINDENT# currentOperations [ ( what , d [ '_db_newObjId' ] ) ] = operation #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = ( "Unrecognized operation '%s'" % operation . vtType ) #NEWLINE# raise TypeError ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return currentOperations