liststoserve

This commit is contained in:
gauthiier 2019-12-28 16:10:41 +01:00
parent d66263bdae
commit 1992e16fd7

View File

@ -2,7 +2,6 @@ from flask import render_template, request, jsonify, send_from_directory
from www import app
import archive.archive as archive
import config
import www.config as wconfig
from datetime import datetime
import os, logging
@ -25,9 +24,9 @@ def lists():
def searh():
if len(request.args) < 1:
# q: list all table or keep predefined wconfig.lists_to_serve?
wconfig.lists_to_serve = archive.list_tables_db(config.db['database'], config.db['host'], config.db['user'], config.db['password'])
return render_template("search.html", archives=wconfig.lists_to_serve, fields=['content', 'from'])
# q: list all table or keep predefined lists_to_serve?
lists_to_serve = archive.list_tables_db(config.db['database'], config.db['host'], config.db['user'], config.db['password'])
return render_template("search.html", archives=lists_to_serve, fields=['content', 'from'])
k_arg = request.args.get('keyword')
l_arg = request.args.get('list')
@ -36,7 +35,7 @@ def searh():
if k_arg is None or k_arg.strip() == '':
return "no keyword..."
if l_arg != "all" and l_arg not in wconfig.lists_to_serve:
if l_arg != "all" and l_arg not in lists_to_serve:
return "list '" + l_arg + "' does not exist"
if f_arg not in ['content', 'from']: