summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorMatej Cotman <cotman.matej@gmail.com>2014-04-24 23:46:40 +0000
committerMatej Cotman <cotman.matej@gmail.com>2014-06-05 13:18:22 +0200
commit08eaffe245303818069df3332eece11f41a0bd8e (patch)
tree9a111cc283b644de9f9df306c531644e8421e283 /searx/utils.py
parent3386e21cdf30bf0accb84e2dcc4dea0076af1b90 (diff)
downloadsearxng-08eaffe245303818069df3332eece11f41a0bd8e.tar.gz
searxng-08eaffe245303818069df3332eece11f41a0bd8e.zip
add multi theming support
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