mirror of
https://github.com/searxng/searxng.git
synced 2025-07-12 15:59:21 +02:00
[enh] better result template handling
This commit is contained in:
parent
20c4de8f06
commit
2f9a386c0d
5 changed files with 34 additions and 6 deletions
|
@ -161,10 +161,23 @@ def get_themes(root):
|
|||
|
||||
|
||||
def get_static_files(base_path):
|
||||
base_path = os.path.join(base_path, 'static')
|
||||
static_files = set()
|
||||
base_path_length = len(base_path+'/static') + 1
|
||||
for directory, _, files in os.walk(os.path.join(base_path, 'static')):
|
||||
base_path_length = len(base_path) + 1
|
||||
for directory, _, files in os.walk(base_path):
|
||||
for filename in files:
|
||||
f = os.path.join(directory[base_path_length:], filename)
|
||||
static_files.add(f)
|
||||
return static_files
|
||||
|
||||
|
||||
def get_result_templates(base_path):
|
||||
base_path = os.path.join(base_path, 'templates')
|
||||
result_templates = set()
|
||||
base_path_length = len(base_path) + 1
|
||||
for directory, _, files in os.walk(base_path):
|
||||
if directory.endswith('result_templates'):
|
||||
for filename in files:
|
||||
f = os.path.join(directory[base_path_length:], filename)
|
||||
result_templates.add(f)
|
||||
return result_templates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue