Skip to content
Snippets Groups Projects
Commit 11ee07e6 authored by Teemu Autto's avatar Teemu Autto
Browse files

If region currency is not supported by ECB, fall back to REF_CURRENCY.

parent 939385ab
No related branches found
No related tags found
No related merge requests found
Pipeline #15388 passed
......@@ -194,9 +194,13 @@ def get_preferred_currency():
# Fall back to the default currency for the locale
if territory := get_locale().territory:
return get_territory_currencies(territory)[0]
else:
return REF_CURRENCY
currency = get_territory_currencies(territory)[0]
if currency in get_currencies():
return currency
else:
logger.warning("Default currency %s is not supported, falling back to %s.", currency, REF_CURRENCY)
return REF_CURRENCY
@click.command()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment