Browse Source

not-working-yet

kora 3 years ago
parent
commit
cbf20e2ab3
1 changed files with 15 additions and 14 deletions
  1. 15 14
      app.py

+ 15 - 14
app.py

@@ -5,24 +5,21 @@ from parsers.get_form_fields import getFormFields, getConfigs
 
 app = Flask(__name__)
 
-@app.route('/', methods=['POST','GET'])
-def main():
 
-    appath = app.root_path + '/'
-    configurationFolder = 'parsers/configuration_files/'
-    configurationFileName = 'configuration.json'   
-    confFilePath = appath + configurationFolder + configurationFileName
-
-    try:
-        configurations = getConfigs(configurationFolder)
-        formFields = getFormFields(confFilePath)
-    except:
-        return redirect(url_for('error', message='no valid config file found'))
+##########################################################################
+# FRONT-END: routes that return a template or redirect to another FE route
+##########################################################################
 
+@app.route('/', methods=['POST','GET'])
+def main():
 
     if request.method == 'POST':
 
         try:
+            appath = app.root_path + '/'
+            configurationFolder = 'parsers/configuration_files/'
+            configurationFileName = 'configuration.json'   
+            confFilePath = appath + configurationFolder + configurationFileName
             outputFolder = appath + 'samples/RDF/'
             fileFromRequest = request.files['FILE']
             filename = fileFromRequest.filename
@@ -64,6 +61,10 @@ def error():
         return render_template('error.html.j2', message=request.args.get('message'))
 
 
+###################################
+# BACK-END: routes that return data
+###################################
+
 @app.route('/download/', methods=['POST', 'GET'])
 def download():
     appath = app.root_path + '/'
@@ -78,8 +79,8 @@ def getData():
     configurationFileName = request.args.get("confFileName")
     confFilePath = appath + configurationFolder + configurationFileName
 
-    appia = getFormFields(confFilePath)
-    return appia
+    formData = getFormFields(confFilePath)
+    return formData