|
@@ -221,6 +221,24 @@ def about():
|
221
|
221
|
return render('about.html')
|
222
|
222
|
|
223
|
223
|
|
|
224
|
+@app.route('/autocompleter', methods=['GET', 'POST'])
|
|
225
|
+def autocompleter():
|
|
226
|
+ """Return autocompleter results"""
|
|
227
|
+ request_data = {}
|
|
228
|
+
|
|
229
|
+ if request.method == 'POST':
|
|
230
|
+ request_data = request.form
|
|
231
|
+ else:
|
|
232
|
+ request_data = request.args
|
|
233
|
+
|
|
234
|
+ # TODO fix XSS-vulnerability, remove test code
|
|
235
|
+ autocompleter.querry = request_data.get('q')
|
|
236
|
+ autocompleter.results = [autocompleter.querry]
|
|
237
|
+
|
|
238
|
+ return Response(json.dumps(autocompleter.results),
|
|
239
|
+ mimetype='application/json')
|
|
240
|
+
|
|
241
|
+
|
224
|
242
|
@app.route('/preferences', methods=['GET', 'POST'])
|
225
|
243
|
def preferences():
|
226
|
244
|
"""Render preferences page.
|