Example #1
0
	def get(self):
		User_id = self.request.cookies.get('user_id')
		Valid_User = check_secure_val(User_id)
		if Valid_User:
			p  = UserAccount.get_by_id(int(Valid_User))
			self.render("welcome.html", User =  p.User)
		else:
			self.redirect("/signup")
Example #2
0
	def get(self):
		User_id = self.request.cookies.get('user_id')
		if User_id:
			Valid_User = check_secure_val(User_id)
			if Valid_User:
				p  = UserAccount.get_by_id(int(Valid_User))
				self.render_front(p.User)
			else:
				self.render_front()
		else:
			self.render_front()
Example #3
0
 def render_front(self, User="", error=""):
     User_id = self.request.cookies.get("user_id")
     if User_id:
         Valid_User = check_secure_val(User_id)
         if Valid_User:
             p = UserAccount.get_by_id(int(Valid_User))
             User = p.User
         else:
             User = ""
     else:
         User = ""
     self.render("firmware.html", User=User, error="")
Example #4
0
	def render_front(self, User = ""):
		User_id = self.request.cookies.get('user_id')
		if User_id:
			Valid_User = check_secure_val(User_id)
			if Valid_User:
				p  = UserAccount.get_by_id(int(Valid_User))
				User = p.User
			else:
				User = ""
		else:
			User = ""
		self.render("purchase.html", User = User)
Example #5
0
	def render_front(self, User = "", username = "", password ="", error = ""):
		User_id = self.request.cookies.get('user_id')
		if User_id:
			Valid_User = check_secure_val(User_id)
			if Valid_User:
				p  = UserAccount.get_by_id(int(Valid_User))
				User = p.User
			else:
				User = ""
		else:
			User = ""
		self.render("login.html", User = "", username = username, password = password, error = error)
Example #6
0
	def render_front(self, error = "", Blog_error=""):
		User_id = self.request.cookies.get('user_id')
		if User_id:
			Valid_User = check_secure_val(User_id)
			if Valid_User:
				p  = UserAccount.get_by_id(int(Valid_User))
				User = p.User
			else:
				User = ""
		else:
			User = ""

		posts = db.GqlQuery("SELECT * FROM Blogpost "
							"ORDER BY created DESC")
		
		self.render("contact.html", User = User, error = "", 
			Blog_error = Blog_error, posts = posts )
Example #7
0
	def post(self):
		User_id = self.request.cookies.get('user_id')
		Valid_User = check_secure_val(User_id)
		p  = UserAccount.get_by_id(int(Valid_User))
		User = p.User		
		newpost_bpost = self.request.get("content")
		posts = db.GqlQuery("SELECT * FROM Blogpost "
							"ORDER BY created DESC")
		if newpost_bpost:
			posts = Blogpost(bpost = newpost_bpost, user = User)
			posts.put()
			posts = db.GqlQuery("SELECT * FROM Blogpost "
							"ORDER BY created DESC")
			self.render("contact.html", User = User, error="", posts = posts)

		else:
			error = "not a valid post"
			self.render("contact.html", User = User, error = "", posts = posts, Blog_error = "Please enter some text before submitting.")
Example #8
0
	def post(self):
		User_id = self.request.cookies.get('user_id')
		Valid_User = check_secure_val(User_id)
		p  = UserAccount.get_by_id(int(Valid_User))
		User = p.User
		Address = self.request.get("Address")
		City = self.request.get("City")
		State = self.request.get("State")
		Country = self.request.get("Country")
		Quantity = self.request.get("Quantity")

		if User and Address and City and State and Country and Quantity:
			posts = Purchase_Order(User = User, Address = Address, City = City, State = State, Country=Country, Quantity=Quantity)
			posts.put()
			self.render("Thankyou.html", User = User)

		else:
			error = 'Please complete all the fields.'
			self.render("purchase.html", User=User, error = error)