summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-06-10 01:18:37 +0200
committerAdam Tauber <asciimoo@gmail.com>2014-06-10 01:18:37 +0200
commit7369fbd54c7a4441065490d2940e6de129cb1b98 (patch)
tree9a111cc283b644de9f9df306c531644e8421e283 /searx/utils.py
parent3386e21cdf30bf0accb84e2dcc4dea0076af1b90 (diff)
parent08eaffe245303818069df3332eece11f41a0bd8e (diff)
Merge pull request #70 from matejc/theming_support
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