comparison src/server/pages.py @ 994:b92b06f023cb

pages: profile is now always set in template_data, and None if there is no user logged
author Goffi <goffi@goffi.org>
date Wed, 13 Dec 2017 00:37:12 +0100
parents 6daa59d44ee2
children f88325b56a6a
comparison
equal deleted inserted replaced
993:641664553a41 994:b92b06f023cb
765 765
766 return data 766 return data
767 767
768 def renderPage(self, request, skip_parse_url=False): 768 def renderPage(self, request, skip_parse_url=False):
769 """Main method to handle the workflow of a LiberviaPage""" 769 """Main method to handle the workflow of a LiberviaPage"""
770
770 # template_data are the variables passed to template 771 # template_data are the variables passed to template
771 if not hasattr(request, 'template_data'): 772 if not hasattr(request, 'template_data'):
772 session_data = self.host.getSessionData(request, session_iface.ISATSession) 773 session_data = self.host.getSessionData(request, session_iface.ISATSession)
773 csrf_token = session_data.csrf_token 774 csrf_token = session_data.csrf_token
774 request.template_data = {u'csrf_token': csrf_token} 775 request.template_data = {u'profile': session_data.profile,
776 u'csrf_token': csrf_token}
775 777
776 # XXX: here is the code which need to be executed once 778 # XXX: here is the code which need to be executed once
777 # at the beginning of the request hanling 779 # at the beginning of the request hanling
778 if request.postpath and not request.postpath[-1]: 780 if request.postpath and not request.postpath[-1]:
779 # we don't differenciate URLs finishing with '/' or not 781 # we don't differenciate URLs finishing with '/' or not