On Thu, Jan 7, 2010 at 4:51 PM, Anand Chitipothu <[email protected]> wrote:
> [...]
>> Hello $:(name|replace:'o', 'x'|fistro:'http://google.es', name)
>
> [...]
>
> print stream("hello") | str.upper | (lambda x: x + " " + x)
>
> However, you need to wrap the object with stream before you can start piping
> it.
I've used Django a lot in the past, and when I saw Templetor for the
first time, I was pleasantly surprised by how cool it's Python
integration was.
1. We all know how to write Python functions and classes, why learn a
whole new API to write _simple_ filters?
2. Why use un-Pythonic piping when you can simply say
`$urlize('http:/whatever/url')`?
So, while I find Anand's tip a nice way to create a DSL using Python,
I don't think template tags are necessarily going to help you with
writing better templates (more than the tools you've already got in
Python).
--
Branko Vukelić
http://foxbunny.tumblr.com/
http://www.flickr.com/photos/16889...@n04/
http://www.twitter.com/foxbunny
--
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en.