Skip to content

Commit

Permalink
Remove guard around opening i18n.json
Browse files Browse the repository at this point in the history
This operation should never fail because the i18n.json file is
shipped with the package and always present.

Possibly the rationale of needing it for tests no longer applies
since the path is now absolute and not relative to the current
working directory.

See <#7443 (comment)>.
  • Loading branch information
legoktm committed Mar 4, 2025
1 parent 31b3c54 commit b4260f4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions securedrop/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,9 @@ def validate_locale_configuration(config: SecureDropConfig, babel: Babel) -> Set
available.add(Locale.parse(FALLBACK_LOCALE))

# These locales are supported in the current version of securedrop-app-code.
try:
with open(I18N_CONF) as i18n_conf_file:
i18n_conf = json.load(i18n_conf_file)
supported = parse_locale_set(i18n_conf["supported_locales"].keys())
# I18N_CONF may not be available under test.
except FileNotFoundError:
supported = available
with open(I18N_CONF) as i18n_conf_file:
i18n_conf = json.load(i18n_conf_file)
supported = parse_locale_set(i18n_conf["supported_locales"].keys())

# These locales were configured via "securedrop-admin sdconfig", meaning
# they were present on the Admin Workstation at "securedrop-admin" runtime.
Expand Down

0 comments on commit b4260f4

Please sign in to comment.