changeset 16:f4920ab1d27c

Add basic html interface for convert This allow testing the code via the browser
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 29 Sep 2014 14:02:55 +0200
parents d2fb4862adb8
children 75d5d18e7d52
files odfcast/convert.py templates/base.html templates/convert.html
diffstat 3 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/odfcast/convert.py	Fri Sep 26 20:18:35 2014 +0200
+++ b/odfcast/convert.py	Mon Sep 29 14:02:55 2014 +0200
@@ -2,7 +2,7 @@
 
 import tempfile
 
-from flask import request, Response, json
+from flask import request, Response, json, render_template
 from flask.views import MethodView
 
 from py3o.template import Template
@@ -45,6 +45,9 @@
         mimetype = self.get_mimetype_for_format(fformat)
         return Response(outfile, mimetype=mimetype)
 
+    def get(self):
+        return render_template("convert.html")
+
     def save_form_file(self, infile):
         outfile = tempfile.NamedTemporaryFile()
         infile.save(outfile.name)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/base.html	Mon Sep 29 14:02:55 2014 +0200
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+    <head>
+        <title>{% block title %}odfcast{% endblock %}</title>
+    </head>
+    <body>
+        <div id="content">
+            {% block content %}{% endblock %}
+        </div>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/convert.html	Mon Sep 29 14:02:55 2014 +0200
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+
+{% block content %}
+<form action="" method="POST" enctype="multipart/form-data">
+    <div>
+        <label>Format</label>
+        <input type="text" placeholder="Format" name="format"></input>
+    </div>
+    <div>
+        <label>File</label>
+        <input type="file" name="file"></input>
+    </div>
+    <input type="submit" value="Convert"></input>
+</form>
+{% endblock %}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)