Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

61 lines (49 sloc) 1.331 kB
from flask import Flask, url_for
from flask.ext.holster.main import init_holster, with_template
from flask.ext.holster.views import HTMLTemplate
app = Flask(__name__)
app.debug = True
app.config["HOLSTER_COMPRESS"] = True
def test():
from math import pi
return {
"data": "Hello from Holster!",
"nested": {
"numeric": 0,
"floating": pi,
"unicode": u"Espa\xf1ol",
"secure": {
"xss-sword": ';!--"<XSS>=&{()}',
custom_template = """
<h1>{{ d.header }}</h1>
@with_template("html", HTMLTemplate(custom_template))
def custom():
return {"header": "HELLO OUT THERE"}
def param(i):
return {"parameter": i}
def multiple(i=None, j=None):
return {"first": i, "second": j}
def bare():
return {"bears": ["grizzly", "black", "panda"]}
def link():
return {
"title": "Link Test",
"html_url": url_for("custom-ext", ext="html"),
"json_url": url_for("custom-ext", ext="json"),
if __name__ == "__main__":
Jump to Line
Something went wrong with that request. Please try again.