﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35522	'NoneType' object has no attribute 'lstrip' when loading single template with relative include without origin	Hovi	nobody	"Behaviour described by this test:


{{{

from django.template import Template, Origin, TemplateSyntaxError
from django.test import TestCase


class TestInclude(TestCase):
    def test_passes(self):
        Template(
            """"""
{% include ""question.html"" %}
        """"""
        )

    def test_also_passes(self):
        Template(
            """"""
{% include ""./question.html"" %}
        """""",
            origin=Origin(
                name=""doesntmatter.html"", template_name=""need-to-be-set.html""
            ),
        )

    def test_fails_correctly(self):
        with self.assertRaises(TemplateSyntaxError) as cm:
            Template(
                """"""
    {% include ""../question.html"" %}
            """""",
                origin=Origin(
                    name=""doesntmatter.html"", template_name=""need-to-be-set.html""
                ),
            )
            self.assertIn(""points outside the file hierarchy that template"", str(cm.exception))

    def test_fails(self):
        with self.assertRaises(AttributeError) as cm:
            Template(
                """"""
        {% include ""./question.html"" %}
            """"""
            )
            self.assertIn(""'NoneType' object has no attribute 'lstrip'"", str(cm.exception))

    def test_fails_on_incorrect_error(self):
        with self.assertRaises(AttributeError) as cm:
            Template(
                """"""
        {% include ""../question.html"" %}
            """"""
            )
            self.assertIn(""'NoneType' object has no attribute 'lstrip'"", str(cm.exception))
"	Bug	closed	Template system	5.0	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
