Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
Actually, since the point of this exercise was to create csv files, I would not use any templating. python has a good csv module, and it will correctly deal with escaping. No templating system is going to get these details correct. See http://docs.python.org/library/csv.html#csv-fmt-params ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
I'd use repoze.bfg.jinja2 for this task. http://pypi.python.org/pypi/repoze.bfg.jinja2/0.6 - C On 2/11/10 1:52 PM, Miuler wrote: *=English==* Hi fiends, i am trying to generate a CSV file, and using templates type zpt (.pt) /---/ /It's a example of text/ /===/ / / /span tal:repeat=user view.getNames()/ /nombre: span tal:replace=user.name http://user.name/span/ //span/ //---// but the repoze.bfg gives me error then I've changed the name to. txt, but I have to change the syntax, which should I use? of Genshi? for I also have to use json Genshi syntax? // // // // // // *=Spanish==* Hola amigos, estoy tratando de generar un archivo CSV, y pero quiero crearlo usando plantillas, trate de usar esto: /---/ /It's a example of text/ /===/ / / /span tal:repeat=user view.getNames()/ /nombre: span tal:replace=user.name http://user.name/span/ //span/ //---// pero bfg me da error: entonces le he cambiado el nombre a .txt, pero veo que tengo que cambiar la sintaxis, cual es la que debo de usar? la de genshi? para plantilla en json tambiƩn debo de usar la sintaxis de genshi? ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
ok thanks, but what is the syntax chameleton_text? url? 2010/2/11 Tres Seaver tsea...@palladion.com -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Miuler wrote: chameleon, puede o no puede renderizar txt? como? 'chameleon.text' lo puede, pero sin todas cosas que el otros pueden (repeticion, por ejemplo). Tres. - -- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Miuler wrote: ok thanks, but what is the syntax chameleton_text? url? I mis-typed, thinking that I remembered a module named 'chameleon.text'. In BFG, you can use the 'repoze.bfg.chameleon_text' helpers, e.g.: from repoze.bfg.chamedeon_text import render_template_to_response def my_view(context, request): return render_template_to_response('templates/my_view.txt', foo='Foo', ... ) See: http://docs.repoze.org/bfg/1.2/api/chameleon_text.html?highlight=chameleon_text#module-repoze.bfg.chameleon_text Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkt0msEACgkQ+gerLs4ltQ50/gCgz6ANNYwriRynuK+YSShbDsxh bBYAnihvaSwmdZeRu6WwI8k3cLOvBc0o =/VyH -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
Mi class: class csv_view(object): def __init__(self, context, request): self.context = context self. request = request def __call__(self): return {'items': [1,2,3,4,5,6]} hello, I'm trying this but fails: === test.csv.txt === #-- #*GENSHI* ${items} (OK) {% for item in items %}\ (NO WORKING) * ${item} (ERROR - no existe item) {% end %}(NO WORKING) #-- #-- #*TAL* span tal:replace= / (NO WORKING) #-- Why? 2010/2/11 Tres Seaver tsea...@palladion.com: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Miuler wrote: ok thanks, but what is the syntax chameleton_text? url? I mis-typed, thinking that I remembered a module named 'chameleon.text'. In BFG, you can use the 'repoze.bfg.chameleon_text' helpers, e.g.: from repoze.bfg.chamedeon_text import render_template_to_response def my_view(context, request): return render_template_to_response('templates/my_view.txt', foo='Foo', ... ) See: http://docs.repoze.org/bfg/1.2/api/chameleon_text.html?highlight=chameleon_text#module-repoze.bfg.chameleon_text Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software Excellence by Designhttp://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkt0msEACgkQ+gerLs4ltQ50/gCgz6ANNYwriRynuK+YSShbDsxh bBYAnihvaSwmdZeRu6WwI8k3cLOvBc0o =/VyH -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
This is why I said use repoze.bfg.jinja2.. Chameleon text templates have no looping constructs and using Chameleon ZPT templates to produce anything except XML is madness. On 2/11/10 8:17 PM, Miuler wrote: Mi class: class csv_view(object): def __init__(self, context, request): self.context = context self. request = request def __call__(self): return {'items': [1,2,3,4,5,6]} hello, I'm trying this but fails: === test.csv.txt === #-- #*GENSHI* ${items} (OK) {% for item in items %}\ (NO WORKING) * ${item} (ERROR - no existe item) {% end %}(NO WORKING) #-- #-- #*TAL* span tal:replace= / (NO WORKING) #-- Why? 2010/2/11 Tres Seaver tsea...@palladion.com mailto:tsea...@palladion.com: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Miuler wrote: ok thanks, but what is the syntax chameleton_text? url? I mis-typed, thinking that I remembered a module named 'chameleon.text'. In BFG, you can use the 'repoze.bfg.chameleon_text' helpers, e.g.: from repoze.bfg.chamedeon_text import render_template_to_response def my_view(context, request): return render_template_to_response('templates/my_view.txt', foo='Foo', ... ) See: http://docs.repoze.org/bfg/1.2/api/chameleon_text.html?highlight=chameleon_text#module-repoze.bfg.chameleon_text Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com mailto:tsea...@palladion.com Palladion Software Excellence by Design http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkt0msEACgkQ+gerLs4ltQ50/gCgz6ANNYwriRynuK+YSShbDsxh bBYAnihvaSwmdZeRu6WwI8k3cLOvBc0o =/VyH -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] templates txt in repoze.bfg and chameleon
thanks Chris McDonough. pd. repoze.bfg.chameleon_text sucks!! :-( 2010/2/11 Chris McDonough chr...@plope.com This is why I said use repoze.bfg.jinja2.. Chameleon text templates have no looping constructs and using Chameleon ZPT templates to produce anything except XML is madness. On 2/11/10 8:17 PM, Miuler wrote: Mi class: class csv_view(object): def __init__(self, context, request): self.context = context self. request = request def __call__(self): return {'items': [1,2,3,4,5,6]} hello, I'm trying this but fails: === test.csv.txt === #-- #*GENSHI* ${items} (OK) {% for item in items %}\ (NO WORKING) * ${item} (ERROR - no existe item) {% end %}(NO WORKING) #-- #-- #*TAL* span tal:replace= / (NO WORKING) #-- Why? 2010/2/11 Tres Seaver tsea...@palladion.com mailto:tsea...@palladion.com: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Miuler wrote: ok thanks, but what is the syntax chameleton_text? url? I mis-typed, thinking that I remembered a module named 'chameleon.text'. In BFG, you can use the 'repoze.bfg.chameleon_text' helpers, e.g.: from repoze.bfg.chamedeon_text import render_template_to_response def my_view(context, request): return render_template_to_response('templates/my_view.txt', foo='Foo', ... ) See: http://docs.repoze.org/bfg/1.2/api/chameleon_text.html?highlight=chameleon_text#module-repoze.bfg.chameleon_text Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com mailto:tsea...@palladion.com Palladion Software Excellence by Design http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkt0msEACgkQ+gerLs4ltQ50/gCgz6ANNYwriRynuK+YSShbDsxh bBYAnihvaSwmdZeRu6WwI8k3cLOvBc0o =/VyH -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev