Mercurial > odfcast
changeset 22:0e40926735e1
Add a generic View to display a template for a get request
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 29 Sep 2014 16:07:25 +0200 |
parents | a8c628466a9d |
children | 709edf15f90e |
files | odfcast/convert.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/odfcast/convert.py Mon Sep 29 16:00:19 2014 +0200 +++ b/odfcast/convert.py Mon Sep 29 16:07:25 2014 +0200 @@ -117,3 +117,18 @@ merger.close() return Response(outfile, mimetype=PDF_MIMETYPE) + + +class TemplateView(MethodView): + + template_name = "" + + def __init__(self, template_name=None): + if template_name: + self.template_name = template_name + + def get_template_name(self): + return self.template_name + + def get(self): + return render_template(self.get_template_name())