Added new updates acording to log.

This commit is contained in:
2024-02-13 15:19:22 +01:00
parent 0735ba4f5a
commit 42a3f773a9
7 changed files with 144 additions and 27 deletions
+21 -2
View File
@@ -8,6 +8,7 @@ import time
import requests
from flask import Flask, render_template, request, send_file, redirect, url_for
from flask_headers import headers
from werkzeug.utils import secure_filename
from stark import run
@@ -134,6 +135,7 @@ def create_app():
return render_template('result.html', head_row=displayed_head, content=displayed_content_dict)
@app.route('/', methods=['GET', 'POST'])
# @headers({'Cache-Control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'})
def index():
if request.method == 'POST':
form = request.form
@@ -240,6 +242,14 @@ def create_app():
configs['detailed_results_file'] = None
configs['frequency_threshold'] = 0
if 'frequency_threshold' in form and form['frequency_threshold']:
try:
int(form['frequency_threshold'])
except ValueError:
validation['frequency_threshold'] = f'Please insert an Integer.'
else:
configs['frequency_threshold'] = int(form['frequency_threshold'])
configs['lines_threshold'] = None
configs['continuation_processing'] = False
@@ -256,14 +266,23 @@ def create_app():
name = ''.join(random.choices(string.ascii_uppercase + string.digits, k=60))
configs['output'] = os.path.join('media', name)
if len(validation) > 0:
a = request.args.get('noreload')
b = request.args
c = request
return render_template('index.html', validation=validation)
try:
run(configs)
except Exception as e:
validation['general'] = 'Processing failed! Please recheck your settings.'
validation['general'] = 'Processing failed! Please recheck your settings, e.g. input format or head node description.'
if len(validation) > 0:
return render_template('index.html', validation=validation)
return redirect(url_for('result', result_id=name))
# check if there are no results
with open(os.path.join('media', name), 'r') as rf:
content = list(csv.reader(rf, delimiter='\t'))
if len(content) == 1:
validation['results'] = False
return render_template('index.html', validation=validation)
return redirect(url_for('result', result_id=name, order_by='Frequency ', order_type='desc'))
return render_template('index.html')
return app