def migrate_log(logs):
 logs_count = logs.count()
 count = 0
 for log in logs:
  count += 1
  node = (log.params.get('node') or log.params.get('project'))
  params_node = Node.load(node)
  if params_node.is_registration:
   log.params['node'] = get_registered_from(params_node)
   log.params['registration'] = params_node._id
  else:
   log.params['registration'] = RegistrationApproval.load(log.params['registration_approval_id'])._get_registration()._id
  log.save()
  logger.info('{}/{} Finished migrating log {}: registration action {}. params[node]={} and params[registration]={}'.format(count, logs_count, log._id, log.action, log.params['node'], log.params['registration']))

def migrate_log ( logs ) : logs_count = logs . count ( ) count = 0 for log in logs : count += 1 node = ( log . params . get ( 'node' ) or log . params . get ( 'project' ) ) params_node = Node . load ( node ) if params_node . is_registration : log . params [ 'node' ] = get_registered_from ( params_node ) log . params [ 'registration' ] = params_node . _id else : log . params [ 'registration' ] = RegistrationApproval . load ( log . params [ 'registration_approval_id' ] ) . _get_registration ( ) . _id log . save ( ) logger . info ( '{}/{} Finished migrating log {}: registration action {}. params[node]={} and params[registration]={}' . format ( count , logs_count , log . _id , log . action , log . params [ 'node' ] , log . params [ 'registration' ] ) )
migrates registration logs to set params[node] to registered_from and params[registration] to the registration .