summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/searx/utils.py b/searx/utils.py
index b8c7a8c6b..a9ece355a 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -1,10 +1,12 @@
-from HTMLParser import HTMLParser
#import htmlentitydefs
-import csv
from codecs import getincrementalencoder
+from HTMLParser import HTMLParser
+from random import choice
+
import cStringIO
+import csv
+import os
import re
-from random import choice
ua_versions = ('26.0', '27.0', '28.0')
ua_os = ('Windows NT 6.3; WOW64',
@@ -110,3 +112,17 @@ class UnicodeWriter:
def writerows(self, rows):
for row in rows:
self.writerow(row)
+
+
+def get_themes(root):
+ """Returns available themes list."""
+
+ static_path = os.path.join(root, 'static')
+ static_names = set(os.listdir(static_path))
+ templates_path = os.path.join(root, 'templates')
+ templates_names = set(os.listdir(templates_path))
+
+ themes = []
+ for name in static_names.intersection(templates_names):
+ themes += [name]
+ return static_path, templates_path, themes