Currently Jinja autoescape has been set to True for upcoming releases
by default to match the behavior all the other template engines have.
I agree that an option would be great, but the default behavior should
be to enable autoscaping to be coherent with the current behavior for
the other template engines.

It probably also make sense to make this options unique for all the
template engines (much like the templates reload is) as it is probably
rare that the user is going to work with escaping enable on some
template engines and disable on others. Then we can provide a template
engine specific option to override it.

On Tue, Oct 2, 2012 at 9:10 PM, Remi Jolin <[email protected]> wrote:
> Carlos,
>
> While you are making changes to app_config.py could you add a new
> configuration option to be able define autoescape at the main level :
>
>         if not 'jinja_filters' in self:
>             self.jinja_filters = {}
>
>         if not 'jinja_autoescape' in self:
>             self.jinja_autoescape = False
>
>         loader = ChoiceLoader(
>             [TemplateLoader(path) for path in self.paths['templates']])
>
>         config['pylons.app_globals'].jinja2_env = Environment(
>                  autoescape=self.jinja_autoescape, loader=loader,
>                  auto_reload=self.auto_reload_templates,
> extensions=self.jinja_extensions)
>
> so we can define
> base_config.jinja_extensions = ['jinja2.ext.with_', 'jinja2.ext.autoescape']
> base_config.jinja_autoescape = True
>  in app_cfg.py
>
> or perhaps there is a better option to achieve this.
>
> Le 29/09/2012 21:58, Carlos Daniel Ruvalcaba Valenzuela a écrit :
>>
>> I pushed to my development branch something very similar, but would
>> like some input from core developers before getting to the pull
>> request.
>>
>>
>> https://github.com/clsdaniel/tg2/commit/7cc62f9130fc9651e7258490874bbc3ca886ba90
>>
>> I'm not sure about having a dictionary inside the __init__.py called
>> jinja_filters, if you have the file and define the dict on __init__.py
>> you will not be able to import jinja_filters.py the way we are doing
>> it right now (via __import__), but we can add a special case to manage
>> that. Keeping it simple seems to be the way to go in my opinion.
>>
>> Perhaps the jinja quickstart template could include
>> templatetools/__init__.py and jinja_filter.py files with some comments
>> to guide the developer.
>>
>> Regards,
>> Carlos Daniel Ruvalcaba Valenzuela
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to