liststoserve
This commit is contained in:
parent
d66263bdae
commit
1992e16fd7
@ -2,7 +2,6 @@ from flask import render_template, request, jsonify, send_from_directory
|
|||||||
from www import app
|
from www import app
|
||||||
import archive.archive as archive
|
import archive.archive as archive
|
||||||
import config
|
import config
|
||||||
import www.config as wconfig
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import os, logging
|
import os, logging
|
||||||
|
|
||||||
@ -25,9 +24,9 @@ def lists():
|
|||||||
def searh():
|
def searh():
|
||||||
|
|
||||||
if len(request.args) < 1:
|
if len(request.args) < 1:
|
||||||
# q: list all table or keep predefined wconfig.lists_to_serve?
|
# q: list all table or keep predefined lists_to_serve?
|
||||||
wconfig.lists_to_serve = archive.list_tables_db(config.db['database'], config.db['host'], config.db['user'], config.db['password'])
|
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'])
|
return render_template("search.html", archives=lists_to_serve, fields=['content', 'from'])
|
||||||
|
|
||||||
k_arg = request.args.get('keyword')
|
k_arg = request.args.get('keyword')
|
||||||
l_arg = request.args.get('list')
|
l_arg = request.args.get('list')
|
||||||
@ -36,7 +35,7 @@ def searh():
|
|||||||
if k_arg is None or k_arg.strip() == '':
|
if k_arg is None or k_arg.strip() == '':
|
||||||
return "no keyword..."
|
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"
|
return "list '" + l_arg + "' does not exist"
|
||||||
|
|
||||||
if f_arg not in ['content', 'from']:
|
if f_arg not in ['content', 'from']:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user