mirror of https://github.com/searxng/searxng.git
[fix] #47
This commit is contained in:
parent
2be94c2078
commit
13a27b909e
|
@ -26,6 +26,7 @@ import json
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from itertools import chain
|
||||||
from flask import (
|
from flask import (
|
||||||
Flask, request, render_template, url_for, Response, make_response,
|
Flask, request, render_template, url_for, Response, make_response,
|
||||||
redirect, send_from_directory
|
redirect, send_from_directory
|
||||||
|
@ -86,10 +87,17 @@ def get_base_url():
|
||||||
|
|
||||||
|
|
||||||
def render(template_name, **kwargs):
|
def render(template_name, **kwargs):
|
||||||
global categories
|
blocked_engines = request.cookies.get('blocked_engines', '').split(',')
|
||||||
kwargs['categories'] = ['general']
|
nonblocked_categories = (engines[e].categories
|
||||||
kwargs['categories'].extend(x for x in
|
for e in engines
|
||||||
sorted(categories.keys()) if x != 'general')
|
if e not in blocked_engines)
|
||||||
|
nonblocked_categories = set(chain.from_iterable(nonblocked_categories))
|
||||||
|
if not 'categories' in kwargs:
|
||||||
|
kwargs['categories'] = ['general']
|
||||||
|
kwargs['categories'].extend(x for x in
|
||||||
|
sorted(categories.keys())
|
||||||
|
if x != 'general'\
|
||||||
|
and x in nonblocked_categories)
|
||||||
if not 'selected_categories' in kwargs:
|
if not 'selected_categories' in kwargs:
|
||||||
kwargs['selected_categories'] = []
|
kwargs['selected_categories'] = []
|
||||||
cookie_categories = request.cookies.get('categories', '').split(',')
|
cookie_categories = request.cookies.get('categories', '').split(',')
|
||||||
|
|
Loading…
Reference in New Issue