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

15 lines
497 B
Python
Raw Normal View History

from flask import render_template, request, Blueprint, current_app
from flask.ext.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
2014-11-10 18:54:46 +02:00
blueprint = Blueprint('search', __name__)
@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)