def set_account_ip(account_id, ip, date=None):
 if ip_address(ip).is_private:
  g.stats.simple_event('ip.private_ip_storage_prevented')
  g.stats.count_string('private_ip_storage_prevented', ip)
  return
 if (date is None):
  date = datetime.datetime.now(g.tz)
 m = Mutator(CONNECTION_POOL)
 m.insert(IPsByAccount._cf, str(account_id), {date: ip}, ttl=CF_TTL)
 m.insert(AccountsByIP._cf, ip, {date: str(account_id)}, ttl=CF_TTL)
 m.send()

def set_account_ip ( account_id , ip , date = None ) : if ip_address ( ip ) . is_private : g . stats . simple_event ( 'ip.private_ip_storage_prevented' ) g . stats . count_string ( 'private_ip_storage_prevented' , ip ) return if ( date is None ) : date = datetime . datetime . now ( g . tz ) m = Mutator ( CONNECTION_POOL ) m . insert ( IPsByAccount . _cf , str ( account_id ) , { date : ip } , ttl = CF_TTL ) m . insert ( AccountsByIP . _cf , ip , { date : str ( account_id ) } , ttl = CF_TTL ) m . send ( )
set an ip address as having accessed an account .