summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-01-01 18:59:53 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-01-01 18:59:53 +0100
commit2f9a386c0db884ffbea27f43bdcff5bfd1876ad1 (patch)
tree152d1e208533261ae8b351cfd9b18b89792008ee /searx/utils.py
parent20c4de8f06cd7f4b04ec37bf8aa28f96be48c093 (diff)
downloadsearxng-2f9a386c0db884ffbea27f43bdcff5bfd1876ad1.tar.gz
searxng-2f9a386c0db884ffbea27f43bdcff5bfd1876ad1.zip
[enh] better result template handling
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/searx/utils.py b/searx/utils.py
index 0594339d5..5bd1ced4d 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -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