Hacker News new | past | comments | ask | show | jobs | submit login

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 :)




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: