Flask Snippets

Snippets are unofficial and unmaintained.

This is an archived view of user-submitted snippets. Despite being hosted on the Flask site, they are not official. No Flask maintainer has curated or checked the snippets for security, correctness, or design.

Using Genshi with Flask

Posted by Dag Odenhall on 2010-05-15 @ 17:27 and filed in Template Tricks

Jinja is a very nice text-based templating engine, but if you want an XML-based templating engine, Genshi is a good choice.

Flask-Genshi is a Flask extension that makes it easy. First install it:

$ easy_install Flask-Genshi

Here's a simple app:

from flask import Flask
from flaskext.genshi import Genshi, render_response

app = Flask(__name__)
genshi = Genshi(app)

@app.route('/')
def index():
    render_response('index.html')

For documentation on Genshi see the Genshi wiki.

This snippet by Dag Odenhall can be used freely for anything you like. Consider it public domain.

Comments