Exemplo n.º 1
0
	def POST(self, post_id):
		i = web.input(author='', email='', url=None, comment='', reply_notify_mail=None)

		# TODO validate email format, and also do it in html javascript.
		if i.author and i.email and i.comment: 
			model.new_comment(post_id, i.author, web.ctx.ip, web.ctx.env['HTTP_USER_AGENT'], i.comment, i.url, i.email, i.reply_notify_mail=='on')

			# TODO difference between seeother and redirect.
			raise web.seeother('/post/' + post_id)
		else:
			# TODO: show error message.
			return render.post(post_id)
Exemplo n.º 2
0
	def GET(self, post_id):
		# TODO validate post through api, or validate in render? use try catch.	
		return render.post(post_id)