예제 #1
0
	def get(self):

		# Get the user
		user = users.get_current_user()

		# Check if the user is logged-in
		if user:
			
			# Lists from DAL
			providers = dal.providers_by_user(user)
			clients = dal.get_clients_by_user(user)
			searches = dal.get_user_searches(user, 5, 2)

			# Locales of the Template
			locales = {
				'title': user.nickname(),
				'description': 'Search Microchips',
				'user': user,
				'providers': providers,
				'provider_count': len(providers),
				'clients': clients,
				'client_count': clients.count(),
				'searches': searches,
				'search_count': len(searches),
				'session': dal.return_and_global_session_update(self),
				'is_current_user_admin': users.is_current_user_admin()
			}

			# Create our template
			template = jinja_environment.get_template('user/profile.html')

			# Render Template
			self.response.out.write(template.render(locales))

		else:
			# Redirect to login
			self.redirect('/signin')