Received: by 10.58.58.206 with SMTP id t14mr437030veq.16.1349256089180; Wed, 03 Oct 2012 02:21:29 -0700 (PDT) X-BeenThere: turbogears@googlegroups.com Received: by 10.220.149.129 with SMTP id t1ls1003358vcv.0.gmail; Wed, 03 Oct 2012 02:21:25 -0700 (PDT) Received: by 10.58.132.135 with SMTP id ou7mr423313veb.10.1349256085681; Wed, 03 Oct 2012 02:21:25 -0700 (PDT) Received: by 10.58.132.135 with SMTP id ou7mr423312veb.10.1349256085670; Wed, 03 Oct 2012 02:21:25 -0700 (PDT) Return-Path: Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by gmr-mx.google.com with ESMTPS id bn19si192100vdb.0.2012.10.03.02.21.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 03 Oct 2012 02:21:25 -0700 (PDT) Received-SPF: pass (google.com: domain of alessandro.mol...@gmail.com designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of alessandro.mol...@gmail.com designates 209.85.220.176 as permitted sender) smtp.mail=alessandro.mol...@gmail.com; dkim=pass header...@gmail.com Received: by mail-vc0-f176.google.com with SMTP id gb22so7180309vcb.7 for ; Wed, 03 Oct 2012 02:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=CBQpK8WH3STh2b+XowctaCcPKt7QdpXnJzVA5pVc7MI=; b=TzC7FrVQkJqU4aAP0i8FFJF3VxYcy7TFHD+uM3dtFa46LapiSGySl8Z97nCE/HA//m ezjVChPlhPMJgId/aozgnZ5z6+8/lEW5IscNG4tUkPEyOuAnuOjxOY7dv57/fdRB6XZZ Wo/Brqj74Ssz11U4LCp9beZP++ScGHfuoKinPgjU7X5CCFHsS2QDL7mnPWGYtGhQAbpf KjeVYMhdfys/TcX8jK2LMuCOCBc6Ktm4eerxgP3q4uKTz/03C0OKtGOtcvpDN/op1cDh ZqGDcgAIvvvtUbeNXPROs1bNdI/uzxsd1K8tyXvzS9IXTJAwetz0jczF+DT6O57Ejd30 IDHw== MIME-Version: 1.0 Received: by 10.220.149.206 with SMTP id u14mr747486vcv.63.1349256085185; Wed, 03 Oct 2012 02:21:25 -0700 (PDT) Received: by 10.58.239.202 with HTTP; Wed, 3 Oct 2012 02:21:25 -0700 (PDT) In-Reply-To: <506B3C08.4060...@sysgroup.fr> References: <5066C8EC.8050...@sysgroup.fr> <5066FD47.3060...@sysgroup.fr> <50672390.9010...@sysgroup.fr> <50672860.8060...@sysgroup.fr> <506744CD.9040...@sysgroup.fr> <506B3C08.4060...@sysgroup.fr> Date: Wed, 3 Oct 2012 11:21:25 +0200 Message-ID: Subject: Re: [TurboGears] adding filters to jinja : templatetools - more changes to app_config.py From: Alessandro Molina To: turbogears@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 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 =3D {} > > if not 'jinja_autoescape' in self: > self.jinja_autoescape =3D False > > loader =3D ChoiceLoader( > [TemplateLoader(path) for path in self.paths['templates']]) > > config['pylons.app_globals'].jinja2_env =3D Environment( > autoescape=3Dself.jinja_autoescape, loader=3Dloader, > auto_reload=3Dself.auto_reload_templates, > extensions=3Dself.jinja_extensions) > > so we can define > base_config.jinja_extensions =3D ['jinja2.ext.with_', 'jinja2.ext.autoesc= ape'] > base_config.jinja_autoescape =3D 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 =E9crit : >> >> 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/7cc62f9130fc9651e7258490874bbc3c= a886ba90 >> >> 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 turbogears@googlegroups.com. > To unsubscribe from this group, send email to > turbogears+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/turbogears?hl=3Den. >