|
|
|
|
|
by ivankirigin
5977 days ago
|
|
Filters are tags in django templates that live in .html files with a bit of logic in a bespoke mini language. XHP for python would be something like this. def view_foo( request ):
baz = "roger, roger"
return render_foo( baz )
def render_foo( name ):
return <html><head></head><body>hi, {name}</body></html>
The most glaring difference is that instead of template logic and keywords, you can use python. You definitely want to sequester rendering from the rest of your view, but I see little benefit to django templates. Missing from this code sample is some django middleware which renders a proper HttpResponse() from the XHP return.I don't know well enough to answer about escaping. Check out the framework, and try it for yourself :) |
|