Exemplo n.º 1
0
Arquivo: webapp.py Projeto: stef/searx
def updates():
    behind, msgs = check('asciimoo','searx', '..')
    if behind == 0:
        return redirect('/')
    kwargs = {'behind': behind,
              'msgs': msgs,
              'githuburl': 'https://www.github.com/asciimoo/searx/commits'}
    return render('updates.html', **kwargs)
Exemplo n.º 2
0
Arquivo: webapp.py Projeto: stef/searx
def render(template_name, **kwargs):
    blocked_engines = request.cookies.get('blocked_engines', '').split(',')
    nonblocked_categories = (engines[e].categories
                             for e in engines
                             if e not in blocked_engines)
    nonblocked_categories = set(chain.from_iterable(nonblocked_categories))

    kwargs['behind'] = check('asciimoo', 'searx', '..')[0]
    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:
        kwargs['selected_categories'] = []
        cookie_categories = request.cookies.get('categories', '').split(',')
        for ccateg in cookie_categories:
            if ccateg in categories:
                kwargs['selected_categories'].append(ccateg)
        if not kwargs['selected_categories']:
            kwargs['selected_categories'] = ['general']
    return render_template(template_name, **kwargs)