DRY
This file contains 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
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