def fix_log_params(targets):
 logger.info('Migrating registration_cancelled, registration_approved, retraction_cancelled, embargo_approved, embargo_cancelled, and embargo_terminated logs.')
 count = 0
 for log in targets:
  node_id = log.params['node']
  node = Node.load(node_id)
  if node.is_registration:
   log.params['node'] = get_registered_from(node)
   log.params['registration'] = node._id
   log.original_node = log.params['node']
   logger.info('Updating params of log {}. params[node]={}, params[registration]={}, and original_node = {}'.format(log._id, log.params['node'], log.params['registration'], log.original_node))
   log.save()
   count += 1
 logger.info('{} logs migrated'.format(count))

def fix_log_params ( targets ) : logger . info ( 'Migrating registration_cancelled, registration_approved, retraction_cancelled, embargo_approved, embargo_cancelled, and embargo_terminated logs.' ) count = 0 for log in targets : node_id = log . params [ 'node' ] node = Node . load ( node_id ) if node . is_registration : log . params [ 'node' ] = get_registered_from ( node ) log . params [ 'registration' ] = node . _id log . original_node = log . params [ 'node' ] logger . info ( 'Updating params of log {}. params[node]={}, params[registration]={}, and original_node = {}' . format ( log . _id , log . params [ 'node' ] , log . params [ 'registration' ] , log . original_node ) ) log . save ( ) count += 1 logger . info ( '{} logs migrated' . format ( count ) )
restores params[registration] field and points params[node] and original_node fields to the node instead of registration .