Changes between Version 1 and Version 5 of Ticket #35493
- Timestamp:
- Jun 4, 2024, 10:39:23 PM (6 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35493
- Property Owner changed from to
- Property Status new → assigned
- Property Has patch set
- Property Needs tests set
-
Ticket #35493 – Description
v1 v5 24 24 Contrapositively, it appears that recursively extending a template using the `extends` tag with a path that does ''not'' contain `./` or `../` raises a `TemplateDoesNotExist` exception. 25 25 26 One possible fix is to modify the `django/template/loader_tags.py` file (https://github.com/django/django/blob/main/django/template/loader_tags.py) such that the error is raised when a template attempts to extend itself (not when a template attempts to include itself, which would otherwise be valid). The error handling logic in question starts on line 267 of that file within the `construct_relative_path` function; perhaps it should live somewhere in the `do_extends` function instead.26 One possible fix is to modify the `django/template/loader_tags.py` file (https://github.com/django/django/blob/main/django/template/loader_tags.py) such that the error is raised when a template attempts to extend itself (not when a template attempts to include itself, which would otherwise be valid). The error handling logic in question starts on line 267 of that file within the `construct_relative_path` function; perhaps it should only be used when called from the `do_extends` function. 27 27 28 28 Here is a relevant discussion in the Django forums: https://forum.djangoproject.com/t/template-recursion-why-does-django-not-allow-and/31689