Commit c4ed4b90 authored by Aron Gergely's avatar Aron Gergely
Browse files

Updated JSON response generation for API resource '/worldmap' and '/translate'

parent 169a8f1c
...@@ -39,7 +39,7 @@ def worldmap(): ...@@ -39,7 +39,7 @@ def worldmap():
with app.open_resource('static/data/countries.geojson') as f: with app.open_resource('static/data/countries.geojson') as f:
data = json.load(f, encoding='utf-8') data = json.load(f, encoding='utf-8')
return json.dumps(data, encoding='utf-8') return Response(json.dumps(data), mimetype='application/json;charset=utf-8')
#return app.send_static_file('data/world_borders.geojson') #return app.send_static_file('data/world_borders.geojson')
@apiv02_bp.route('/attributes/<attribute_name>', methods=['GET']) @apiv02_bp.route('/attributes/<attribute_name>', methods=['GET'])
...@@ -62,7 +62,7 @@ def available_translations(): ...@@ -62,7 +62,7 @@ def available_translations():
#for language in available_languages #for language in available_languages
result["languages"]= available_languages[0] result["languages"]= available_languages[0]
return jsonify(result) return Response(json.dumps(result, indent=3), mimetype='application/json;charset=utf-8')
@apiv02_bp.route('/translation/<language>', methods=['GET']) @apiv02_bp.route('/translation/<language>', methods=['GET'])
...@@ -70,9 +70,9 @@ def translations(language=None): ...@@ -70,9 +70,9 @@ def translations(language=None):
result = tree() result = tree()
query = Translation.query.filter(Translation.language_code==language) query = Translation.query.filter(Translation.language_code==language)
phrases = query
for item in query: for phrase in phrases:
result[item.original]=item.translated result[phrase.original]=phrase.translated
return Response(json.dumps(result, indent=3), mimetype='application/json;charset=utf-8') return Response(json.dumps(result, indent=3), mimetype='application/json;charset=utf-8')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment