Exemple #1
0
	def post(self):
		topic = self.request.get('topic')
		stories = nprloader.loadStories(TOPICS[topic], URL)
		story = self.request.get('story')
		try:
			story_id = stories[story]
			self.redirect('/story?id='+story_id)
		except KeyError as e:
			self.response.out.write("<p>Sorry, NPR is telling me that story doesn't exist anymore! (according to its response)</p>"+
									"<p>However, if you wanted to check that for yourself, I would start <a href='http://www.google.com/?q=NPR%20"+story+"'>here</a>")
Exemple #2
0
	def get(self):
		topic = self.request.get('topic')
		self.response.out.write(topic)
		stories = nprloader.loadStories(TOPICS[topic], URL)

		template_vals = {
			"user" : template_values['last_user'],
			"topic" : topic,
			'stories' : stories
		}
		if template_vals['user'] == '':
			template_vals['user'] = template_values['user']
		template = JINJA_ENV.get_template('stories.html')
		self.response.out.write(template.render(template_vals))