From ec5ce95e77762ba8528cc3e69f291690e5c92fe3 Mon Sep 17 00:00:00 2001 From: sipp11 Date: Fri, 14 Nov 2014 05:02:10 +0700 Subject: [PATCH] Update Movie to version 1 which support en/th --- flasky.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/flasky.py b/flasky.py index 024ee37..ad80cb1 100644 --- a/flasky.py +++ b/flasky.py @@ -68,14 +68,21 @@ def hello_world(): @app.route('/movies/', methods=['GET']) +@app.route('/movies//', methods=['GET']) @crossdomain(origin='*') -def movie_list(): +def movie_list(lang='en'): result = db.movies.find() movies = [] for i in result: + if 'original' in i['title']: + i['original_title'] = i['title']['original'] + i['title'] = i['title'][lang] + i['cast'] = i['cast'][lang] + i['tagline'] = i['tagline'][lang] + i['storyline'] = i['storyline'][lang] + i['director'] = i['director'][lang] movies.append(i) - if len(movies) > 10: - break + json_dict = { 'meta': { 'total_count': len(movies)