Ejemplo n.º 1
0
	def get(self):
		if self.auth():
			author = self.read_cookie("username")
			author = secure.original_val(author)
			self.render_main(author=author)
		else:
			error_msg = "You have an invalid session, please login again"
			self.redirect("/logout?error_msg="+error_msg)
Ejemplo n.º 2
0
	def get(self):

		if self.auth():
			username = self.read_cookie("username")
			username = secure.original_val(username)
			self.render("welcome.html", username = username)

		else:
			self.redirect("/signup")
Ejemplo n.º 3
0
	def post(self):
		# author = self.request.get("author")
		author = self.read_cookie("username")
		author = secure.original_val(author)
		title = self.request.get("title")
		post = self.request.get("post")

		if author and post and title:
			p = Post(author=author, title=title, post=post)
			p.put()
			time.sleep(0.1)
			Post.recent_posts(update = True)
			Post.by_author(author = author, update = True)
			self.redirect("/posts/%s" % str(p.key().id()) )

		else:
			error_msg = "Please fill out all the fields."
			self.render_main(author, title, post, error_msg)
Ejemplo n.º 4
0
	def get_user(self):
		username = self.read_cookie("username")
		username = secure.original_val(username)
		return username