|
@@ -1,4 +1,4 @@
|
|
|
-from flask import Flask, request, redirect, render_template, url_for
|
|
|
+from flask import Flask, request, redirect, render_template, url_for, send_file
|
|
|
from parsers.CSV_to_RDF_generico import parse, parsefromfile
|
|
|
from parsers.get_form_fields import getFormFields
|
|
|
|
|
@@ -42,14 +42,15 @@ def main():
|
|
|
|
|
|
check = [val for val in data.values() if val!='']
|
|
|
if len(check)>0:
|
|
|
- outFilePath = outputFolder + 'form_output.ttl'
|
|
|
+ outFileName = 'form_output.ttl'
|
|
|
+ outFilePath = outputFolder + outFileName
|
|
|
parse(confFilePath, formFields, [data], outFilePath)
|
|
|
else:
|
|
|
raise Exception("No data")
|
|
|
except:
|
|
|
return redirect(url_for('error'))
|
|
|
|
|
|
- return redirect(url_for('main', success=True))
|
|
|
+ return redirect(url_for('download', filename=outFileName))
|
|
|
|
|
|
return render_template('index.html', data=formFields)
|
|
|
|
|
@@ -62,5 +63,18 @@ def error():
|
|
|
return render_template('error.html')
|
|
|
|
|
|
|
|
|
+@app.route('/', methods=['POST', 'GET'])
|
|
|
+def download():
|
|
|
+ appath = app.root_path + '/'
|
|
|
+ outFileName = request.args.get('filename')
|
|
|
+ outFilePath = appath + 'samples/RDF/' + outFileName
|
|
|
+ return send_file(outFilePath, as_attachment=True)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
app.run()
|
|
|
+
|
|
|
+
|
|
|
+
|