def fix_reg_approved_log_params(targets):
 logger.info('Migrating registration_approved logs.')
 count = 0
 for log in targets:
  log.params['registration'] = RegistrationApproval.load(log.params['registration_approval_id'])._get_registration()._id
  logger.info('Updating params[registration] of log {}. params[node]={}, params[registration]={}'.format(log._id, log.params['node'], log.params['registration'], log.original_node))
  log.save()
  count += 1
 logger.info('{} logs migrated'.format(count))

def fix_reg_approved_log_params ( targets ) : logger . info ( 'Migrating registration_approved logs.' ) count = 0 for log in targets : log . params [ 'registration' ] = RegistrationApproval . load ( log . params [ 'registration_approval_id' ] ) . _get_registration ( ) . _id logger . info ( 'Updating params[registration] of log {}. params[node]={}, params[registration]={}' . 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 .