jpgil / cl-concerts-db

Plataforma para almacenar y consultar una lista de conciertos de música docta en Chile
GNU General Public License v3.0
2 stars 0 forks source link

KeyError: 'language' en biografias2021 #33

Closed jpgil closed 2 years ago

jpgil commented 2 years ago

@kirlts , intenté correr el branch (biografias2021) y me arrojó el siguiente error, parece que la variable language no está bien definida. El https://github.com/epikt/cl-concerts-db/pull/31 está inválido.

Traceback (most recent call last):
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 1815, in handle_user_exception
    return self.handle_http_exception(e)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/app.py", line 1743, in handle_http_exception
    return handler(e)
  File "/Users/jgil/Code/cl-concerts-db/app/errors/handlers.py", line 8, in not_found_error
    return render_template('errors/404.html'), 404
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/templating.py", line 137, in render_template
    return _render(
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/Users/jgil/Code/cl-concerts-db/app/templates/errors/404.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/Users/jgil/Code/cl-concerts-db/app/templates/base.html", line 1, in top-level template code
    {% extends 'bootstrap/base.html' %}
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 1, in top-level template code
    {% block doc -%}
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 4, in block "doc"
    {%- block html %}
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 6, in block "html"
    {%- block head %}
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_bootstrap/templates/bootstrap/base.html", line 7, in block "head"
    <title>{% block title %}{{title|default}}{% endblock title %}</title>
  File "/Users/jgil/Code/cl-concerts-db/app/templates/base.html", line 3, in block "title"
    {% if title %}{{ title }} - CL-CONCERTS-DB {% else %}{{ _('Bienvenido a cl-concerts-db') }}{% endif %}
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/jinja2/ext.py", line 144, in _gettext_alias
    return __context.call(__context.resolve("gettext"), *args, **kwargs)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/jinja2/ext.py", line 150, in gettext
    rv = __context.call(func, __string)
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_babel/__init__.py", line 116, in <lambda>
    lambda x: get_translations().ugettext(x),
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_babel/__init__.py", line 227, in get_translations
    [get_locale()],
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask_babel/__init__.py", line 257, in get_locale
    rv = babel.locale_selector_func()
  File "/Users/jgil/Code/cl-concerts-db/app/__init__.py", line 103, in get_locale
    return session['language'] # The function returns the language stored in config.py as "defaultlang"
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/werkzeug/local.py", line 378, in <lambda>
    __getitem__ = lambda x, i: x._get_current_object()[i]
  File "/Users/jgil/Code/cl-concerts-db/venv/lib/python3.9/site-packages/flask/sessions.py", line 84, in __getitem__
    return super(SecureCookieSession, self).__getitem__(key)
KeyError: 'language'
jpgil commented 2 years ago

Fixed in commit 7d83d79 (see for changes). Tested in my local env, tested in http://basedeconciertos.uahurtado.cl:5099/public/inicio?language=en