def migrate_guid_log(log):
 for key in ['project', 'node']:
  if (key in log.params):
   value = (log.params[key] or '')
   record = models.Node.load(value.lower())
   if (record is not None):
    log.params[key] = record._primary_key
 if ('contributor' in log.params):
  if isinstance(log.params['contributor'], basestring):
   record = models.User.load(log.params['contributor'].lower())
   if record:
    log.params['contributor'] = record._primary_key
 if ('contributors' in log.params):
  for (idx, uid) in enumerate(log.params['contributors']):
   if isinstance(uid, basestring):
    record = models.User.load(uid.lower())
    if record:
     log.params['contributors'][idx] = record._primary_key
 data = log.to_storage()
 if data['user']:
  record = models.User.load(data['user'].lower())
  if record:
   log.user = record
 log.save()

def migrate_guid_log ( log ) : for key in [ 'project' , 'node' ] : if ( key in log . params ) : value = ( log . params [ key ] or '' ) record = models . Node . load ( value . lower ( ) ) if ( record is not None ) : log . params [ key ] = record . _primary_key if ( 'contributor' in log . params ) : if isinstance ( log . params [ 'contributor' ] , basestring ) : record = models . User . load ( log . params [ 'contributor' ] . lower ( ) ) if record : log . params [ 'contributor' ] = record . _primary_key if ( 'contributors' in log . params ) : for ( idx , uid ) in enumerate ( log . params [ 'contributors' ] ) : if isinstance ( uid , basestring ) : record = models . User . load ( uid . lower ( ) ) if record : log . params [ 'contributors' ] [ idx ] = record . _primary_key data = log . to_storage ( ) if data [ 'user' ] : record = models . User . load ( data [ 'user' ] . lower ( ) ) if record : log . user = record log . save ( )
migrate non-reference fields containing primary keys on logs .