Project

General

Profile

Actions

Bug #4800

closed

There is a HTTP 500 error sometimes because of undefined locale setting in current session.

Added by Jan Mach about 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Development - GUI
Target version:
Start date:
03/01/2019
Due date:
% Done:

100%

Estimated time:
To be discussed:

Description

For some reason there is a possibility for locale setting to be undefined in the session which results in following error:

Message type: CRITICAL
Location:     /usr/lib/python3/dist-packages/hawat/app.py:210
Module:       app
Function:     eh_internal_server_error
Time:         2019-03-01 12:38:47,582

Message:

Internal Server Error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.5/dist-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/hawat/base.py", line 1139, in dispatch_request
    return self.generate_response()
  File "/usr/lib/python3/dist-packages/hawat/base.py", line 489, in generate_response
    **self.response_context
  File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 135, in render_template
    context, ctx.app)
  File "/usr/local/lib/python3.5/dist-packages/flask/templating.py", line 117, in _render
    rv = template.render(context)
  File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.5/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.5/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/hawat/blueprints/home/templates/home/index.html", line 1, in top-level template code
    {% extends "_layout.html" %}
  File "/usr/lib/python3/dist-packages/hawat/blueprints/design/templates/_layout.html", line 13, in top-level template code
    {%- block head %}
  File "/usr/lib/python3/dist-packages/hawat/blueprints/design/templates/_layout.html", line 46, in block "head" 
    {%- block headjs %}
  File "/usr/lib/python3/dist-packages/hawat/blueprints/design/templates/_layout.html", line 121, in block "headjs" 
    "{{ url_for('design.static', filename='vendor/cldr/main/' + session['locale'] + '/numbers.json') }}",
TypeError: Can't convert 'NoneType' object to str implicitly
Actions #1

Updated by Jan Mach about 5 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 90

Patch implemented, waiting for verification after deployment on development server.

Actions #2

Updated by Radko Krkoš almost 5 years ago

  File "/usr/lib/python3/dist-packages/hawat/blueprints/design/templates/_layout.html", line 121, in block "headjs" 
    "{{ url_for('design.static', filename='vendor/cldr/main/' + session['locale'] + '/numbers.json') }}",

I would suggest instead of trying to reproduce this (as it seems mostly Internet Explorer related), to fix this here:
Modifying session['locale'] to:

session['locale'] if session['locale'] else 'sensible_default'

as the problem stems from session['locale'] sometimes being None.

Actions #3

Updated by Jan Mach almost 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF