Ejemplo n.º 1
0
	def post(self, question_id):
		if not live.continue_after_checking_https_and_secret(self):
			return
			
		q = Question.get(Key(question_id))
		if q is None:
			self.error(404)
			return
		
		if q.question_kind != Question.FREEFORM:
			self.error(400)
			self.response.headers['X-IL-Error-Reason'] = 'Only freeform questions can have answers'
			return
		
		a = Answer(question = q)
		text = self.request.get('text')
		if text == '':
			self.error(400)
			self.response.headers['X-IL-Error-Reason'] = 'You must specify text for an answer'
			return
			
		a.text = text
		
		a.put()
		self.redirect(AnswerView.url(a))
Ejemplo n.º 2
0
	def delete(self, answer_id):
		if not live.continue_after_checking_https_and_secret(self):
			return
		
		a = Answer.get(Key(answer_id))
		if a is None:
			self.error(404)
			return
		
		a.delete()
Ejemplo n.º 3
0
	def post(self, answer_id):
		if not live.continue_after_checking_https_and_secret(self):
			return

		if self.request.get('delete') == 'true':
			self.delete(answer_id)