diff options
| author | asciimoo <asciimoo@gmail.com> | 2013-10-15 20:50:12 +0200 |
|---|---|---|
| committer | asciimoo <asciimoo@gmail.com> | 2013-10-15 20:50:12 +0200 |
| commit | b752ace653de24f90449c1f05cde7f334cce3279 (patch) | |
| tree | 751288ecd8b9a51b4aa0757700dc134c50f2d549 /searx | |
| parent | d793c2733c7aac3aacf40f3f5cf9fc0919305e76 (diff) | |
[enh] template render updates
Diffstat (limited to 'searx')
| -rw-r--r-- | searx/webapp.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 2dd9e28d7..1c88bcc6f 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -25,7 +25,7 @@ if __name__ == "__main__": from flask import Flask, request, flash, render_template import ConfigParser from os import getenv -from searx.engines import search +from searx.engines import search, engines cfg = ConfigParser.SafeConfigParser() cfg.read('/etc/searx.conf') @@ -37,16 +37,20 @@ cfg.read('searx.conf') app = Flask(__name__) app.secret_key = cfg.get('app', 'secret_key') +def render(template_name, **kwargs): + kwargs['engines'] = engines.keys() + return render_template(template_name, **kwargs) + @app.route('/', methods=['GET', 'POST']) def index(): if request.method=='POST': if not request.form.get('q'): flash('Wrong post data') - return render_template('index.html') + return render('index.html') query = request.form['q'] results = search(query, request) - return render_template('results.html', results=results, q=query) - return render_template('index.html') + return render('results.html', results=results, q=query) + return render('index.html') if __name__ == "__main__": from gevent import monkey |