Changes between Version 1 and Version 5 of Ticket #35493


Ignore:
Timestamp:
Jun 4, 2024, 10:39:23 PM (6 months ago)
Author:
Gabriel Nick Pivovarov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35493

    • Property Owner changed from nobody to Gabriel Nick Pivovarov
    • Property Status newassigned
    • Property Has patch set
    • Property Needs tests set
  • Ticket #35493 – Description

    v1 v5  
    2424Contrapositively, it appears that recursively extending a template using the `extends` tag with a path that does ''not'' contain `./` or `../` raises a `TemplateDoesNotExist` exception.
    2525
    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.
     26One 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.
    2727
    2828Here is a relevant discussion in the Django forums: https://forum.djangoproject.com/t/template-recursion-why-does-django-not-allow-and/31689
Back to Top