diff options
| author | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2014-12-13 21:37:28 +0100 |
|---|---|---|
| committer | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2014-12-13 21:37:28 +0100 |
| commit | e71b665fd5d62ddc52fda3eca141547bb3540522 (patch) | |
| tree | abbbf42b974bf4f0205baeafa9c690771cf27636 /searx/webapp.py | |
| parent | 53a9af39efb0c444bfacd40c440208ba33ee75c4 (diff) | |
Load the list of icons only once
Diffstat (limited to 'searx/webapp.py')
| -rw-r--r-- | searx/webapp.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index bb412df69..6387a92f4 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -71,6 +71,13 @@ babel = Babel(app) #TODO configurable via settings.yml favicons = ['wikipedia', 'youtube', 'vimeo', 'dailymotion', 'soundcloud', 'twitter', 'stackoverflow', 'github', 'deviantart'] + +global_favicons = [] +for indice,theme in enumerate(themes): + global_favicons.append([]) + theme_img_path = searx_dir+"/static/"+theme+"/img/" + for (dirpath, dirnames, filenames) in os.walk(theme_img_path): + global_favicons[indice].extend(filenames) cookie_max_age = 60 * 60 * 24 * 365 * 23 # 23 years @@ -292,11 +299,6 @@ def index(): if engine in favicons: result['favicon'] = engine - mypath = searx_dir+"/static/"+get_current_theme_name()+"/img/" - favs=[] - for (dirpath, dirnames, filenames) in os.walk(mypath): - favs.extend(filenames) - # TODO, check if timezone is calculated right if 'publishedDate' in result: result['pubdate'] = result['publishedDate'].strftime('%Y-%m-%d %H:%M:%S%z') @@ -350,7 +352,7 @@ def index(): answers=search.answers, infoboxes=search.infoboxes, theme=get_current_theme_name(), - favicons=favs + favicons=global_favicons[themes.index(get_current_theme_name())] ) |