# HG changeset patch # User Goffi # Date 1513121832 -3600 # Node ID b92b06f023cbfd8934533cb3c585476385baf5ef # Parent 641664553a41651a6d67e123dee4c0e5564ba047 pages: profile is now always set in template_data, and None if there is no user logged diff -r 641664553a41 -r b92b06f023cb src/pages/login/logged/page_meta.py --- a/src/pages/login/logged/page_meta.py Wed Dec 13 00:35:56 2017 +0100 +++ b/src/pages/login/logged/page_meta.py Wed Dec 13 00:37:12 2017 +0100 @@ -7,7 +7,3 @@ """SàT log-in page, with link to create an account""" template = u"login/logged.html" - - -def prepare_render(self, request): - request.template_data['profile'] = self.getProfile(request) diff -r 641664553a41 -r b92b06f023cb src/pages/merge-requests/view/page_meta.py --- a/src/pages/merge-requests/view/page_meta.py Wed Dec 13 00:35:56 2017 +0100 +++ b/src/pages/merge-requests/view/page_meta.py Wed Dec 13 00:37:12 2017 +0100 @@ -35,8 +35,6 @@ if profile is None: profile = C.SERVICE_PROFILE - else: - template_data['profile'] = profile tickets, metadata, parsed_tickets = yield self.host.bridge.mergeRequestsGet(service.full() if service else u'', node, diff -r 641664553a41 -r b92b06f023cb src/pages/tickets/view/page_meta.py --- a/src/pages/tickets/view/page_meta.py Wed Dec 13 00:35:56 2017 +0100 +++ b/src/pages/tickets/view/page_meta.py Wed Dec 13 00:37:12 2017 +0100 @@ -35,8 +35,6 @@ if profile is None: profile = C.SERVICE_PROFILE - else: - template_data['profile'] = profile tickets = yield self.host.bridge.ticketsGet(service.full() if service else u'', node, C.NO_LIMIT, [ticket_id], '', {}, profile) ticket = [template_xmlui.create(self.host, x, ignore=['publisher']) for x in tickets[0]][0] diff -r 641664553a41 -r b92b06f023cb src/server/pages.py --- a/src/server/pages.py Wed Dec 13 00:35:56 2017 +0100 +++ b/src/server/pages.py Wed Dec 13 00:37:12 2017 +0100 @@ -767,11 +767,13 @@ def renderPage(self, request, skip_parse_url=False): """Main method to handle the workflow of a LiberviaPage""" + # template_data are the variables passed to template if not hasattr(request, 'template_data'): session_data = self.host.getSessionData(request, session_iface.ISATSession) csrf_token = session_data.csrf_token - request.template_data = {u'csrf_token': csrf_token} + request.template_data = {u'profile': session_data.profile, + u'csrf_token': csrf_token} # XXX: here is the code which need to be executed once # at the beginning of the request hanling