Make template rendering calls suck a bit less.
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 11 Jun 2010 20:54:10 -0400 |
parents |
776a8c6e70a0
|
children |
b45d0345f936
|
branches/tags |
flask |
files |
review/web_ui.py |
Changes
--- a/review/web_ui.py Fri Jun 11 20:51:49 2010 -0400
+++ b/review/web_ui.py Fri Jun 11 20:54:10 2010 -0400
@@ -54,17 +54,18 @@
datastore = None
site_read_only = False
+def render(template, **kwargs):
+ return render_template(template,
+ read_only=site_read_only, utils=utils, datastore=datastore,
+ **kwargs)
+
@app.route('/')
def index():
rev_max = datastore.target['tip'].rev()
rev_min = rev_max - LOG_PAGE_LEN if rev_max >= LOG_PAGE_LEN else 0
rcsets = [datastore[r] for r in xrange(rev_max, rev_min, -1)]
- return render_template('index.html',
- read_only=site_read_only,
- utils=utils, datastore=datastore, title='',
- rcsets=rcsets,
- )
+ return render('index.html', title='', rcsets=rcsets)