[Django] #28516: Admin change_list logs multiple "VariableDoesNotExist" errors.

7 views
Skip to first unread message

Django

unread,
Aug 21, 2017, 11:24:15 PM8/21/17
to django-...@googlegroups.com
#28516: Admin change_list logs multiple "VariableDoesNotExist" errors.
-------------------------------------+-------------------------------------
Reporter: Samuel | Owner: nobody
Bishop |
Type: | Status: new
Cleanup/optimization |
Component: Template | Version: 1.11
system | Keywords:
Severity: Normal | VariableDoesNotExist,
| django.contrib.admin, admin,
Triage Stage: | template, logging, errors,
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
By default the Django admin list view logs multiple errors while working
normally. This is somewhat undesirable since errors and tracebacks do not
typically accompany correct and expected behaviour.

Simply silencing all 'debug' template errors is less than ideal since it
hides other possible errors we want to be informed about.
If the error were shorter, perhaps not including the traceback, that may
be enough to improve the situation.
Basically, I don't expect the well tested and maintained admin templates
to emit a wall of errors that is more reminiscent of the entire world
being on fire due to horribly buggy code I have written.

This is the same issue that is behind #26886, just in a different
template. If there is no way to solve these at the template code level,
its probably fair to close this ticket as a duplicate of a new ticket for
the underlying problem that needs solving to make this less of an issue.

This is the large amount of error text accompanying debug logging when
loading any admin list view.

{{{
2017-08-22T03:04:44.811998Z [debug ] Exception while resolving variable
'errors' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [errors]
in 'None'
2017-08-22T03:04:44.816519Z [debug ] Exception while resolving variable
'errors' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [errors]
in 'None'
2017-08-22T03:04:44.840210Z [debug ] Exception while resolving variable
'show' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/context.py", line 75, in __getitem__
raise KeyError(key)
KeyError: 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 891, in _resolve_lookup
if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [show] in
"[{'True': True, 'False': False, 'None': None, 'csrf_token':
<SimpleLazyObject: '...'>}]"
2017-08-22T03:04:44.843559Z [debug ] Exception while resolving variable
'show' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/context.py", line 75, in __getitem__
raise KeyError(key)
KeyError: 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 891, in _resolve_lookup
if isinstance(current, BaseContext) and getattr(type(current), bit):
AttributeError: type object 'RequestContext' has no attribute 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'show'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [show] in
"[{'True': True, 'False': False, 'None': None, 'csrf_token':
<SimpleLazyObject: '...'>}]"
2017-08-22T03:04:44.847828Z [debug ] Exception while resolving variable
'is_multipart' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'is_multipart'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'is_multipart'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key
[is_multipart] in 'None'
2017-08-22T03:04:44.850196Z [debug ] Exception while resolving variable
'is_multipart' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'is_multipart'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'is_multipart'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key
[is_multipart] in 'None'
2017-08-22T03:04:45.017252Z [debug ] Exception while resolving variable
'non_field_errors' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key
[non_field_errors] in 'None'
2017-08-22T03:04:45.020119Z [debug ] Exception while resolving variable
'non_field_errors' in template 'admin/change_list.html'. [django.template]
Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 885, in _resolve_lookup
current = current[bit]
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 893, in _resolve_lookup
current = getattr(current, bit)
AttributeError: 'NoneType' object has no attribute 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 900, in _resolve_lookup
current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'non_field_errors'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/techdragon/code/test_project/venv/lib/python3.6/site-
packages/django/template/base.py", line 907, in _resolve_lookup
(bit, current)) # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key
[non_field_errors] in 'None'
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28516>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 21, 2017, 11:26:15 PM8/21/17
to django-...@googlegroups.com
#28516: Admin change_list logs multiple "VariableDoesNotExist" errors.
-------------------------------------+-------------------------------------
Reporter: Samuel Bishop | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Template system | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage:
VariableDoesNotExist, | Unreviewed
django.contrib.admin, admin, |
template, logging, errors, |

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Samuel Bishop:

Old description:

New description:

By default the Django admin list view logs multiple errors while working
normally. This is somewhat undesirable since errors and tracebacks do not
typically accompany correct and expected behaviour.

Simply silencing all 'debug' template errors is less than ideal since it
hides other possible errors we want to be informed about.
If the error were shorter, perhaps not including the traceback, that may
be enough to improve the situation.
Basically, I don't expect the well tested and maintained admin templates
to emit a wall of errors that is more reminiscent of the entire world
being on fire due to horribly buggy code I have written.

This is the same issue that is behind #26886, just in a different
template. If there is no way to solve these at the template code level,
its probably fair to close this ticket as a duplicate of a new ticket for
the underlying problem that needs solving to make this less of an issue.

This is the large amount of error text accompanying debug logging when

loading any admin list view. This is all produced by a ''single'' page
load of admin list for a sample model.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28516#comment:1>

Django

unread,
Aug 24, 2017, 11:11:26 AM8/24/17
to django-...@googlegroups.com
#28516: Admin change_list logs multiple "VariableDoesNotExist" errors.
-------------------------------------+-------------------------------------
Reporter: Samuel Bishop | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
VariableDoesNotExist, | Unreviewed
django.contrib.admin, admin, |
template, logging, errors, |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed
* component: Template system => contrib.admin
* resolution: => duplicate


Comment:

I created #28526 to address the problem of verbose, often unhelpful
logging of undefined variables.

--
Ticket URL: <https://code.djangoproject.com/ticket/28516#comment:2>

Reply all
Reply to author
Forward
0 new messages