Created
March 27, 2012 04:02
-
-
Save j2labs/2212434 to your computer and use it in GitHub Desktop.
attempting to make a poisonous Brubeck handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from brubeck.request_handling import Brubeck, http_response | |
from brubeck.templating import load_jinja2_env | |
from brubeck.templating import Jinja2Rendering | |
app = Brubeck(mongrel2_pair=('ipc://127.0.0.1:9999', | |
'ipc://127.0.0.1:9998'), | |
template_loader=load_jinja2_env('./templates/jinja2')) | |
@app.add_route('^/', method=['GET', 'POST']) | |
def index(application, message): | |
print 'App:', application | |
name = message.get_argument('name', 'dude') | |
context = { | |
'name': name, | |
} | |
body = application.render_template('success.html', **context) | |
application = {} | |
return http_response(body, 200, 'OK', {}) | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment