Skip to content

[BUG] All-time user searches (the default) in Radius accounting tool is broken #3500

@lunkwill42

Description

@lunkwill42

Describe the bug

The default search mode for the Radius Account Log search is a "username" search with the time options set to "All time".

Inputting a username and clicking "Search" causes a crash with a traceback. Things work as expected if Time options is set to Days and a valid number of days is entered in the field below.

It seems to me this may have been broken by #3289.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Tools → Radius
  2. Ensure the Search for * dropdown is set to Username
  3. Enter any characters into the form field below the dropdown
  4. Click the Search button
  5. See error

Expected behavior

A search result should appear, with no crashes.

Screenshots

Tracebacks

Traceback (most recent call last):
  File "/home/vscode/.venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/nav/python/nav/django/../../nav/web/radius/views.py", line 61, in index
    return account_search(request)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/nav/python/nav/django/../../nav/web/radius/views.py", line 221, in account_search
    if form.is_valid():
       ^^^^^^^^^^^^^^^
  File "/home/vscode/.venv/lib/python3.11/site-packages/django/forms/forms.py", line 201, in is_valid
    return self.is_bound and not self.errors
                                 ^^^^^^^^^^^
  File "/home/vscode/.venv/lib/python3.11/site-packages/django/forms/forms.py", line 196, in errors
    self.full_clean()
    ^^^^^^^^^^^^^^^^^
  File "/home/vscode/.venv/lib/python3.11/site-packages/django/forms/forms.py", line 433, in full_clean
    self._clean_fields()
    ^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.venv/lib/python3.11/site-packages/django/forms/forms.py", line 448, in _clean_fields
    value = getattr(self, "clean_%s" % name)()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/nav/python/nav/django/../../nav/web/radius/forms.py", line 247, in clean_time
    time_type, time = self.cleaned_data["time"]
    ^^^^^^^^^^^^^^^

Exception Type: ValueError at /radius/
Exception Value: not enough values to unpack (expected 2, got 0)

Environment (please complete the following information):

  • NAV version installed: 5.14.1 (master)

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions