Example #1
0
	def get(self):
		pollobj = Poll.get_by_id('us_state_2012')
		if not pollobj:
			logging.info('Poll does not exist')
			getpolls()
			pollobj = Poll.get_by_id('us_state_2012')
			if pollobj is None:
				raise Exception("Poll not found")
		else:
			logging.info('Poll found')

		self.response.headers['Content-Type'] = 'application/json'
		self.response.out.write(dumps(pollobj.poll))
Example #2
0
	def get(self):
		pollobj = Poll.get_by_id('us_state_2012')
		if not pollobj:
			logging.info('Poll does not exist')
			getpolls()
			pollobj = Poll.get_by_id('us_state_2012')
			if pollobj is None:
				raise Exception("Poll not found")
		else:
			logging.info('Poll found')

		template_values = {
			'data': dumps(pollobj.poll),
			'lastupdate': pollobj.updated,
			'ga_id': ga_id
		}

		template = jinja_environment.get_template('d3demo.html')

		self.response.out.write(template.render(template_values))