Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Crash in Sentry #399

Open
odscjames opened this issue Sep 1, 2023 · 1 comment
Open

Python Crash in Sentry #399

odscjames opened this issue Sep 1, 2023 · 1 comment

Comments

@odscjames
Copy link
Collaborator

odscjames commented Sep 1, 2023

KeyError 'fr'

https://datastore.codeforiati.org/api/1/access/activity.xlsx

locale=fr&recipient-country=BD&ref=qb&reporting-org=CA-3


  File "iatilib/frontend/serialize/csv.py", line 576, in call
    row = [accessor(obj) for accessor in self.fields_by_major_version[get_major_version(obj)].values()]
  File "iatilib/frontend/serialize/csv.py", line 576, in <listcomp>
    row = [accessor(obj) for accessor in self.fields_by_major_version[get_major_version(obj)].values()]
  File "iatilib/frontend/serialize/csv.py", line 70, in sector
    return u";".join(
  File "iatilib/frontend/serialize/csv.py", line 71, in <genexpr>
    codelists.localised_description(sec.sector, locale)
  File "iatilib/codelists/init.py", line 108, in localised_description
    return u"%s" % item.translations[locale] if item and item.translations[locale] else u""
@odscjames odscjames changed the title Pythor Crash in Sentry Python Crash in Sentry Sep 1, 2023
@markbrough
Copy link
Member

Looks like some codelist is missing a translation:
https://github.com/search?q=repo%3AcodeforIATI%2Fiati-datastore%20translations&type=code

So I guess we should look for the translation, and otherwise fall back to the English language here?

return u"%s" % item.translations[locale] if item and item.translations[locale] else u""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants