#33830: Variable lookup errors are logged rendering 'clearable_file_input.html'
-------------------------------------+-------------------------------------
               Reporter:  Horst      |          Owner:  nobody
  Schneider                          |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:             |        Version:  4.0
  contrib.admin                      |
               Severity:  Normal     |       Keywords:  admin, template
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 It seems like the fix to #31536 raised a problem similar to #32681: Not
 checking whether the `disabled` attribute actually exists on the `attrs`
 of the 'clear' checkbox widget causes a `VariableDoesNotExist` exception
 to be logged every time one of the patched `clearable_file_input.html`
 templates is rendered with a checkbox that has no `disabled` atrribute
 (i.e. is enabled):

 {{{
 [2022-07-06 10:06:03,452] DEBUG django.template base: Exception while
 resolving variable 'disabled' in template
 'admin/widgets/clearable_file_input.html'.
 Traceback (most recent call last):
   File "/home/horst/some_project/venv/lib/python3.10/site-
 packages/django/template/base.py", line 875, in _resolve_lookup
     current = current[bit]
 KeyError: 'disabled'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/horst/some_project/venv/lib/python3.10/site-
 packages/django/template/base.py", line 885, in _resolve_lookup
     current = getattr(current, bit)
 AttributeError: 'dict' object has no attribute 'disabled'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/horst/some_project/venv/lib/python3.10/site-
 packages/django/template/base.py", line 891, in _resolve_lookup
     current = current[int(bit)]
 ValueError: invalid literal for int() with base 10: 'disabled'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/horst/some_project/venv/lib/python3.10/site-
 packages/django/template/base.py", line 898, in _resolve_lookup
     raise VariableDoesNotExist(
 django.template.base.VariableDoesNotExist: Failed lookup for key
 [disabled] in {'id': 'id_document'}
 }}}

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070181d7967486-04ce8b4a-36f3-4f84-ad74-a2abb73b0e9c-000000%40eu-central-1.amazonses.com.

Reply via email to