def ValidateXsrfToken(token, action):
 user_str = _MakeUserStr()
 token_obj = memcache.get(token, namespace=MEMCACHE_NAMESPACE)
 if (not token_obj):
  return False
 (token_str, token_action) = token_obj
 if ((user_str != token_str) or (action != token_action)):
  return False
 return True

def ValidateXsrfToken ( token , action ) : user_str = _MakeUserStr ( ) token_obj = memcache . get ( token , namespace = MEMCACHE_NAMESPACE ) if ( not token_obj ) : return False ( token_str , token_action ) = token_obj if ( ( user_str != token_str ) or ( action != token_action ) ) : return False return True
validate a given xsrf token by retrieving it from memcache .