#30453: Django's template library tags cant use already decorated things like
lru_cache because of getfullargspec
-------------------------------------+-------------------------------------
Reporter: Batuhan | Owner: Batuhan Taşkaya
Taşkaya |
Type: Bug | Status: assigned
Component: Template | Version: 2.2
system |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Django's template library tags cant use already decorated things like
lru_cache because of getfullargspec. I have a tag that requires to be
lru_cached but i cant use it without an helper.
{{{
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/utils/autoreload.py", line 54,
in wrapper
fn(*args, **kwargs)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-
packages/django/core/management/commands/runserver.py", line 117, in
inner_run
self.check(display_num_errors=True)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/core/management/base.py", line
390, in check
include_deployment_checks=include_deployment_checks,
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/core/management/base.py", line
377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/core/checks/registry.py", line
72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/contrib/admin/checks.py", line
79, in check_dependencies
for engine in engines.all():
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/utils.py", line 90,
in all
return [self[alias] for alias in self]
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/utils.py", line 90,
in <listcomp>
return [self[alias] for alias in self]
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/utils.py", line 81,
in __getitem__
engine = engine_cls(params)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/backends/django.py",
line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/backends/django.py",
line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/backends/django.py",
line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/backends/django.py",
line 121, in get_package_libraries
module = import_module(entry[1])
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in
_call_with_frames_removed
File "/home/batuhan/qubic/aspava/social/templatetags/renderer.py", line
25, in <module>
@lru_cache(None)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/library.py", line
132, in simple_tag
return dec(func)
File "/home/batuhan/.local/share/virtualenvs/aspava-
SBPNYCrJ/lib/python3.7/site-packages/django/template/library.py", line
109, in dec
params, varargs, varkw, defaults, kwonly, kwonly_defaults, _ =
getfullargspec(func)
File "/usr/lib64/python3.7/inspect.py", line 1132, in getfullargspec
raise TypeError('unsupported callable') from ex
TypeError: unsupported callable
}}}
It can be solved with unwrapping the function like templates/base.py did.
--
Ticket URL: <https://code.djangoproject.com/ticket/30453>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.87de9f0b2354c4f8ea14fc6389737215%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.