Ok. Thanks, Alessandro León
On Thursday, 11 April 2013 17:02:00 UTC+2, [email protected] wrote: > > Starting from 2.2.1 Jinja has autoescaping enabled by default like all the > other template engines did. This makes so that TurboGears has a consistent > behavior of escaping independently from the engine used. > > You can update your code using markupsafe.Markup to mark parts that should > not be escaped or explicitly disable the escaping using a before_config > hook to change base_config['pylons.app_globals'].jinja2_env.autoescape to > False. > > > On Thu, Apr 11, 2013 at 1:41 PM, León Domingo <[email protected]<javascript:> > > wrote: > >> Hi people, >> >> Right now I'm using TG 2.2.0 and I've tried TG 2.2.2 but I have problems >> during template parsing. >> I use Jinja2 (2.6) and *use_dotted_templatenames = False* and don't use * >> .jinja* extension for templates, but .html, .js, etc. >> >> The problem is that everything is escaped so if I have something like >> this: >> >> import simplejson as sj >> >> class AController(BaseController): >> @expose('foo/bar/my_template.html') >> def my_template(self): >> something = sj.dumps(dict(foo='foo', bar='bar')) >> return dict(something=something) >> >> Then inside the HTML template (foo/bar/my_template.html) >> >> <html> >> <body> >> <script> >> var something = {{something}}; >> console.log(something.foo); // 'foo' >> console.log(something.bar); // 'bar' >> </script> >> </body> >> </html> >> >> This ain't work because *{{something}}* is escaped to be HTML-suited >> instead of its "raw" format. >> >> Same thing happens with the default error page. Instead of >> >> *We're sorry but we weren't able to process this request.* >> >> I get >> >> *<p>We're sorry but we weren't able to process this request.</p>* >> >> Does anybody know what's going on? >> >> *I have say that this happen with an existing app, upgrading TG2 version >> from 2.2.0 to 2.2.2. I simply use another virtual environment.* >> >> Thanks >> >> Regards, >> León >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "TurboGears Trunk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/turbogears-trunk?hl=en >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/turbogears-trunk?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
