def country(country): stories = globalvoices.recent_stories_from( country ) return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories )
def country(country): stories = globalvoices.recent_stories_from(country) return render_template("stories.html", country_list_json_text=json.dumps( globalvoices.country_list()), country_name=country, stories=stories)
def country(country): #Set the number os stories to show stories = globalvoices.recent_stories_from( country, repeatStory ) return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories )
def country(country): stories = globalvoices.recent_stories_from( country, numStory ) #We send the variable through this function return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories )
def country(country): # check db for stories if db_stories.find({'country':country}).count() > 0: # load and return db stories stories = db_stories.find({'country':country}) else: #else if no stories in db, grab them from the server and add to db stories = globalvoices.recent_stories_from( country ) for story in stories: db_stories.insert(story) return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories )
def country(country): stories = globalvoices.recent_stories_from( country ) tweet_list = country_tweets(country) country_entry = query_db('select * from Country where Name = ?', [country], one=True) language = query_db('select Language from CountryLanguage where CountryCode = ?', [country_entry['Code']], one=True) return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories, tweets=tweet_list, language=language, population=country_entry['Population'] ) return render_template("tweets.html", )
def country(country): if mongo_stories.find({'country':country}).count > 0: stories = mongo_stories.find({'country':country}) else: stories = globalvoices.recent_stories_from( country ) for story in stories: mongo_stories.insert(story) return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories ) if __name__ == "__main__": app.debug = True app.run()
def country(country): # check if there are stories in database for country if mongo_stories.find({'country':country}).count() > 0: # if there are, load and return those stories stories = mongo_stories.find({'country':country}) # logging.info('Loading from Mongo...') # print "Loading from Mongo..." # if there aren't, retrieve from server and save to database else: stories = globalvoices.recent_stories_from( country ) # logging.info('Loading from RSS...') # print "Loading from RSS..." for story in stories: mongo_stories.insert(story) return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()), country_name=country, stories=stories )
def country(country): stories = globalvoices.recent_stories_from(country) tweet_list = country_tweets(country) country_entry = query_db('select * from Country where Name = ?', [country], one=True) language = query_db( 'select Language from CountryLanguage where CountryCode = ?', [country_entry['Code']], one=True) return render_template("stories.html", country_list_json_text=json.dumps( globalvoices.country_list()), country_name=country, stories=stories, tweets=tweet_list, language=language, population=country_entry['Population']) return render_template("tweets.html", )
def index(): return render_template("stories.html", country_list_json_text=json.dumps(globalvoices.country_list()) )
def index(): return render_template("stories.html", country_list_json_text=json.dumps( globalvoices.country_list()))