Exemple #1
0
	def get(self, nickname):

		if nickname == '':

			self.redirect('/')

		else:

			profile = AccountIO()
			profile.getFromNickname( nickname )

			# Called user doesn't exist
			if not profile.account:

				self.redirect('/')

			else:

				user = AccountIO()
				user.getFromSession()

				posts = PostRead()

				'''if isOwner:
					token = Token()
					token.account = account.key()
					avatar_token  = string.join( random.sample( string.letters + string.digits, 30  ), '' )
					token.code    = avatar_token
					expires = datetime.now() + timedelta( hours = 1 )
					token.expires = expires
					token.put()
				else:
					avatar_token = '' '''


				# Template values
				template_values = {
					'user': user.account,
					'profile': profile.account,
					'profileFollowing': user.isFollowing( profile ),
					'profileFolled': user.isFollowing( profile ),
					'profileMessages': posts.getSentMessages( profile.account ),
					'profileFollowed': profile.getFollowed(),
					'profileFollowers': profile.getFollowers()
				}

				# We get the template path then show it
				path = os.path.join(os.path.dirname(__file__), '../views/profile.html')
				self.response.out.write(template.render(path, template_values))
Exemple #2
0
	def get(self):

		user = AccountIO()
		postread = PostRead()

		user.getFromSession()

		# Template values, yay!
		if user.account:
			template_values = {
				'messages': postread.getMessages(user.account),
				'nickname': user.account.nickname
			}
		else:
			template_values = {
				'messages': postread.getAllMessages(),
				'nickname': ''
			}

		# We get the template path then show it
		path = os.path.join(os.path.dirname(__file__), '../views/index.html')
		self.response.out.write(template.render(path, template_values))