This morning I was boring and I think that could be cool to have django
style filters in web.py templator, something like $:('http://webpy.org'|
urlize).
I created a branch at github [1]. I don't know if it's interesting for
someone but there it is.
Here you have an example of use:
import web
urls = ('.*', 'index')
def fistro(input, direction, title):
return '<a href="'+direction+'" title="'+title+'">'+input+'</a>'
class index:
def GET(self):
template = """$def with (name)\n
<html>
<body>
Hello $:(name|replace:'o', 'x'|fistro:'http://google.es', name)
</body>
</html>
"""
hello = web.template.Template(template,
globals={'fistro':fistro, 'replace':str.replace})
return hello('world')
app = web.application(urls, globals())
if __name__ == '__main__':
app.run()
[1] http://github.com/danigm/webpy
--
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.