py3.11 compatible f-string

This commit is contained in:
Masen Furer 2025-01-24 00:11:17 -08:00
parent bb7619ebea
commit 6c76b9130e
No known key found for this signature in database
GPG Key ID: B0008AD22B3B3A95

View File

@ -1985,20 +1985,18 @@ def check_config_option_in_tier(
config = get_config() config = get_config()
authenticated_token = hosting.authenticated_token() authenticated_token = hosting.authenticated_token()
the_remedy = [] if not authenticated_token[0]:
if not authenticated_token: the_remedy = (
the_remedy.append(
"You are currently logged out. Run `reflex login` to access this option." "You are currently logged out. Run `reflex login` to access this option."
) )
current_tier = "anonymous" current_tier = "anonymous"
else: else:
current_tier = authenticated_token[1].get("tier", "").lower() current_tier = authenticated_token[1].get("tier", "").lower()
the_remedy.append( the_remedy = (
f"Your current subscription tier is `{current_tier}`. Please upgrade to {allowed_tiers} to access this option." f"Your current subscription tier is `{current_tier}`. "
f"Please upgrade to {allowed_tiers} to access this option."
) )
if current_tier not in allowed_tiers: if current_tier not in allowed_tiers:
console.warn( console.warn(f"Config option `{option_name}` is restricted. {the_remedy}")
f"Config option `{option_name}` is restricted. {'\n'.join(the_remedy)}"
)
setattr(config, option_name, fallback_value) setattr(config, option_name, fallback_value)
config._set_persistent(**{option_name: fallback_value}) config._set_persistent(**{option_name: fallback_value})