realms-wiki/realms/modules/search/views.py

19 lines
562 B
Python
Raw Permalink Normal View History

from __future__ import absolute_import
from flask import render_template, request, Blueprint, current_app
2016-09-05 00:08:18 +03:00
from flask_login import current_user
2014-11-13 01:06:56 +02:00
from realms import search as search_engine
2014-11-12 01:06:28 +02:00
blueprint = Blueprint('search', __name__, template_folder='templates')
2014-11-10 18:54:46 +02:00
@blueprint.route('/_search')
def search():
if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous:
return current_app.login_manager.unauthorized()
2014-11-13 01:06:56 +02:00
results = search_engine.wiki(request.args.get('q'))
return render_template('search/search.html', results=results)