niwinz / django-jinja

Simple and nonobstructive jinja2 integration with Django.
http://niwinz.github.io/django-jinja/latest/
BSD 3-Clause "New" or "Revised" License
363 stars 102 forks source link

Jinja2 3.1.x still breaks backend #298

Closed bschollnick closed 1 year ago

bschollnick commented 1 year ago

Yes, this is a a semi-duplicate of #294.

You mentioned that this was fixed? But I am able to reproduce this issue with Django v4.1.3, Django-Jinja2 v2.10.2, and Jinja2 v3.1.2?

The implication is that on March 29th, this was a non-issue? But it's still happening 11/22/2022? Does a release need to be made? Does it need to be released to PyPi?

I am creating a new issue, since my comment in #294 may not have been noticed since that is a closed ticket.

wizpig64 commented 1 year ago

Hi bschollnick, I meant to reply to you in the other thread but forgot about it over holiday chores.

Jinja2 removed jinja2.ext.with_ and jinja2.ext.autoescape in their 3.1 release: https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0

django-jinja does not reference those extensions, so there's nothing we need to do about it on our side.

Your project is probably referencing those gone extensions somewhere in your settings module.

They would be in the ["OPTIONS"]["extensions"] part of of your template settings, like here in the testing repo, and you'll want to remove these lines if you find them:

    "jinja2.ext.with_",
    "jinja2.ext.autoescape",

the release notes say that with and autoescape are built-in features now, so you might not have to change your templates at all.

bschollnick commented 1 year ago

Ah. I see.

And you are correct, they were in the extensions in the settings... I was fooled by the traceback showing the crash being in the django-jinja2 code....

Thanks!