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

[BUG] Translation uncaught exception #1122

Closed
2 of 8 tasks
seirdotexe opened this issue Feb 20, 2024 · 4 comments
Closed
2 of 8 tasks

[BUG] Translation uncaught exception #1122

seirdotexe opened this issue Feb 20, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@seirdotexe
Copy link

seirdotexe commented Feb 20, 2024

Describe the bug
When a translatian isn't found, an uncaught exception is thrown.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1341, in handle_user_exception
    return self.handle_http_exception(e)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1281, in handle_http_exception
    return self.ensure_sync(handler)(e)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/whoogle/app/routes.py", line 609, in page_not_found
    return render_template('error.html', error_message=str(e)), 404
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 151, in render_template
    return _render(app, template, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 132, in _render
    rv = template.render(context)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/whoogle/app/templates/error.html", line 23, in top-level template code
    <h4><a class="link" href="https://farside.link">{{ translation['continue-search'] }}</a></h4>
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 466, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'translation' is undefined

To Reproduce
Steps to reproduce the behavior:

  1. Search anything

Deployment Method

  • Heroku (one-click deploy)
  • Docker
  • run executable
  • pip/pipx
  • Other: [describe setup]

Version of Whoogle Search

  • Latest build from Docker
  • Version [version number]
  • Not sure

Desktop (please complete the following information):

  • OS: Windows 11 x64
  • Browser: Firefox 123.0b9 (64-bit)

Additional context
Also reported in #1100 (comment)

@seirdotexe seirdotexe added the bug Something isn't working label Feb 20, 2024
@varunpan
Copy link

I am getting the same error from the latest version and casing my instance to crash.

@ahmad-alkadri
Copy link
Contributor

ahmad-alkadri commented Mar 2, 2024

Found the same error when I clicked the "Dark Design: Deactivate" button at the bottom. Screen record:

screencast-localhost_5000-2024 03 02-08_57_49

Logs output at the end said the same thing:

jinja2.exceptions.UndefinedError: 'translation' is undefined

At a glance it looks like the error is from Jinja.

@ahmad-alkadri
Copy link
Contributor

Drafted a PR that seems to fix this (at least locally on my machines): #1126.

Would be happy to discuss.

@seirdotexe
Copy link
Author

Drafted a PR that seems to fix this (at least locally on my machines): #1126.

Would be happy to discuss.

Looks great. Hopefully @benbusby can merge.

@benbusby benbusby linked a pull request Mar 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants