Project

General

Profile

Actions

Bug #7466

closed

Viewing details of abuse group in reports/dashboard results in internal server error

Added by Rajmund Hruška almost 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Development - GUI
Target version:
Start date:
07/01/2021
Due date:
% Done:

100%

Estimated time:
To be discussed:
No

Description

Clicking on the 'View details of abuse group ...' in Reporting dashboard results in an exception. Tested on my local machine as well as mentat-alt. Here is a traceback:

Traceback (most recent call last):
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
    return view_func(**req.view_args)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask_login/utils.py", line 272, in decorated_view
    return func(*args, **kwargs)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/rajmund/mentat-ng/lib/vial/view/__init__.py", line 1356, in dispatch_request
    return self.generate_response()
  File "/home/rajmund/mentat-ng/lib/vial/view/mixin.py", line 94, in generate_response
    **self.response_context
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/templating.py", line 140, in render_template
    ctx.app,
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/home/rajmund/mentat-ng/lib/hawat/blueprints/groups/templates/groups/show.html", line 1, in top-level template code
    {%- extends "_layout.html" %}
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/environment.py", line 1005, in render
    return concat(self.root_render_func(self.new_context(vars)))
  File "/home/rajmund/mentat-ng/lib/hawat/blueprints/groups/templates/groups/show.html", line 14, in root

  File "/home/rajmund/mentat-ng/lib/vial/blueprints/design_bs3/templates/_layout.html", line 22, in root

  File "/home/rajmund/mentat-ng/lib/vial/blueprints/design_bs3/templates/_layout.html", line 188, in block_body
    {%- endblock head %}
  File "/home/rajmund/mentat-ng/lib/hawat/blueprints/groups/templates/groups/show.html", line 38, in block_content
    </a>
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/runtime.py", line 570, in __call__
    return self._invoke(arguments, autoescape)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 110, in _invoke
    return original_invoke(self, arguments, autoescape)
  File "/home/rajmund/mentat-ng/venv/lib/python3.7/site-packages/jinja2/runtime.py", line 574, in _invoke
    rv = self._func(*arguments)
  File "/home/rajmund/mentat-ng/lib/vial/blueprints/design_bs3/templates/_macros_page.html", line 18, in macro
    {{ menu_item.get_title(item = context_item) }}
  File "/home/rajmund/mentat-ng/lib/vial/view/__init__.py", line 1316, in get_breadcrumbs_menu
    paramlist = []
  File "/home/rajmund/mentat-ng/lib/vial/menu.py", line 562, in add_entry
    entry = EndpointEntry(ident, **kwargs)
  File "/home/rajmund/mentat-ng/lib/vial/menu.py", line 450, in __init__
    kwargs['view'] = flask.current_app.get_endpoint_class(endpoint)
  File "/home/rajmund/mentat-ng/lib/vial/app.py", line 228, in get_endpoint_class
    "Unknown endpoint name '{}'.".format(endpoint)
vial.app.VialException: Unknown endpoint name 'groups.list_by_name'.

Related issues

Blocks Mentat - Task #7494: Fix skipped/broken unit testsClosedRajmund Hruška07/19/2021

Actions
Actions #1

Updated by Rajmund Hruška almost 3 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
  • To be discussed deleted (No)

The test which checks groups.show_by_name endpoint was disabled in commit 643ebf57. The change which caused this bug, happened in the commit 244745ca, lib/vial/lib/__init__.py/get_breadcrumbs_menu function. When show_by_name is accessed, there is a new entry created - groups.list_by_name and this endpoint doesn't exists.

The first solution I came up with was removing this entry completely from action_menu. Although it seems to be working fine, this solution is a bit too destructive.

The other solution is writing a simple if statement which prevents from adding this entry to action_menu. This is simple but not very general. There may be some other endpoints which lead to a similar bug.

In commit 92b75ed2 I chose the latter solution. I would suggest dealing with this more generally in case some other bug of this kind is found. If that's OK, the code is ready to be merged to devel in branch hruska-bugfix-#7466-reports-dashboard.

Actions #2

Updated by Rajmund Hruška over 2 years ago

  • Blocks Task #7494: Fix skipped/broken unit tests added
Actions #3

Updated by Pavel Kácha over 2 years ago

I'd suggest trying to find the reasoning (commit message?), removing the 'replace' altogether, and do some testing.

Actions #4

Updated by Rajmund Hruška over 2 years ago

  • Status changed from Resolved to In Progress
  • % Done changed from 100 to 90
  • To be discussed set to Yes
Actions #5

Updated by Rajmund Hruška over 2 years ago

  • To be discussed changed from Yes to No

I looked at the commit which introduced the bug. From my understanding, there was an attempt to make code more abstract and general. I will try removing the replace functions and change it back to the original form and I will check the endpoints.

Actions #6

Updated by Rajmund Hruška over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 90 to 100

I removed the replace functions and it seems to be working.

Actions #7

Updated by Rajmund Hruška over 2 years ago

  • Status changed from Resolved to In Review

Merged into devel.

Actions #8

Updated by Pavel Kácha about 2 years ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF