Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception while resolving variable 'form_error_title' in template 'bulma/uni_form.html' in debug log #16

Open
leolivier opened this issue Mar 24, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@leolivier
Copy link

leolivier commented Mar 24, 2024

Hi

crispy-bulma              0.11.0 
django-crispy-forms       2.1        

When using bulma crispy forms, it seems to be working fine as long as I don't set the logging in DEBUG level.
If I change django logging to DEBUG, my log is totally overwhelmed (thousands of line for each screen) by errors starting with Exception while resolving variable 'form_error_title' in template 'bulma/uni_form.html'
Part of the stack trace is:

System check identified no issues (0 silenced).
..Exception while resolving variable 'form_error_title' in template 'bulma/uni_form.html'.
Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 875, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/context.py", line 83, in __getitem__
    raise KeyError(key)
KeyError: 'form_error_title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 881, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(
                                            ^^^^^^^^
AttributeError: type object 'Context' has no attribute 'form_error_title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 891, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'form_error_title'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 898, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [form_error_title] in [{'True': True, 'False': False, 'None': None}, {'field_class': '', 'field_template': 'bulma/field.html', 'form_show_errors': True, 'form_show_labels': True, 'label_class': '', 'form': <AuthenticationForm bound=True, valid=False, fields=(username;password)>}, {}]
Exception while resolving variable 'exclude_field_wrapper' in template 'bulma/uni_form.html'.
Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 875, in _resolve_lookup
    current = current[bit]
              ~~~~~~~^^^^^
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/context.py", line 83, in __getitem__
    raise KeyError(key)
KeyError: 'exclude_field_wrapper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 881, in _resolve_lookup
    if isinstance(current, BaseContext) and getattr(
                                            ^^^^^^^^
AttributeError: type object 'Context' has no attribute 'exclude_field_wrapper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 891, in _resolve_lookup
    current = current[int(bit)]
                      ^^^^^^^^
ValueError: invalid literal for int() with base 10: 'exclude_field_wrapper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/olivi/miniconda3/envs/cousinsmatter/lib/python3.12/site-packages/django/template/base.py", line 898, in _resolve_lookup
    raise VariableDoesNotExist(
django.template.base.VariableDoesNotExist: Failed lookup for key [exclude_field_wrapper] in [{'True': True, 'False': False, 'None': None}, {'field_class': '', 'field_template': 'bulma/field.html', 'form_show_errors': True, 'form_show_labels': True, 'label_class': '', 'form': <AuthenticationForm bound=True, valid=False, fields=(username;password)>}, {'forloop': {'parentloop': {}, 'counter0': 0, 'counter': 1, 'revcounter': 2, 'revcounter0': 1, 'first': True, 'last': False}, 'field': <django.forms.boundfield.BoundField object at 0x7fa507190560>}, {}]

Then (due to the embedded exception I think), I have the same stack trace for the variables named exclude_field_wrapper , which in turns trigger the same stack for the variable wrapper_class, then form_horizontal (4 or 5 times the same stack trace)....

And then it restarts the same whole stack trace multiple times...

@ckrybus
Copy link
Owner

ckrybus commented Mar 28, 2024

Hi, I can reproduce it, but it is not something which can be fixed easily. We would need to modify the global Field context, but Field is being imported from django-crispy-forms ...

The extra context from crispy-bootstrap5, for example use_custom_control, is declared in the package django-crispy-forms, but I can't do that here.

This "error" is more or less normal when using django and is not an issue in production. I'll leave it open for now, maybe someone else has an idea how to fix it. For me it is a low priority issue.

@ckrybus ckrybus added the help wanted Extra attention is needed label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants