Mercurial > libervia-web
changeset 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 | 641664553a41 |
children | f88325b56a6a |
files | src/pages/login/logged/page_meta.py src/pages/merge-requests/view/page_meta.py src/pages/tickets/view/page_meta.py src/server/pages.py |
diffstat | 4 files changed, 3 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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,
--- 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]
--- 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