pallets / jinja

A very fast and expressive template engine.
https://jinja.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.6k forks source link

`select_autoescape` default value for `default_for_string` should be `False` #1890

Open clavedeluna opened 11 months ago

clavedeluna commented 11 months ago

According to jinja's select_autoescape documentation

The select_autoescape() function returns a function that works roughly like this:

def autoescape(template_name): if template_name is None: return False

Furthermore, the docs makes it clear that jinja's default autoescape is still False. So, If I setup autoescape like this:

from jinja2 import Environment, select_autoescape
env = Environment(autoescape=select_autoescape())

I would expect autoescape to end up as False

However, in the code here when template_name is None, it returns the default value of default_for_string, which at this time is True.

Should default_for_string not be False, just like default?

Environment: