Skip to content

Instantly share code, notes, and snippets.

@skhaz
Created March 23, 2013 02:33
Embed
What would you like to do?
DRY
def render(*args, **kwargs):
import inspect
call_frame = inspect.getouterframes(inspect.currentframe(), 2)
template = jinja2.get_template('{}.html'.format(call_frame[1][3]))
return template.render(*args, **kwargs)
@route('/')
@memorize
def index():
entries = db.Query(Entry).order('-published').fetch(limit=25)
return render(entries=entries)
@route('/archive')
@memorize
def archive():
return render()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment