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))