comparison src/pages/tickets/new/page_meta.py @ 968:4d37b23777c3

pages (core, tickets/new): replaced post_redirect_uri mechanism by post_redirect_page: instead of giving a full uri, a page is now given when we want to redirect to something else that current page on data post. This make the redirection more simple and intuive A tuple can be used to specify arguments to put in URL.
author Goffi <goffi@goffi.org>
date Thu, 09 Nov 2017 08:02:47 +0100
parents 4d1dcf97740f
children 8943ee1cf3d7
comparison
equal deleted inserted replaced
967:4d1dcf97740f 968:4d37b23777c3
4 from libervia.server.constants import Const as C 4 from libervia.server.constants import Const as C
5 from twisted.internet import defer 5 from twisted.internet import defer
6 from sat.tools.common import template_xmlui 6 from sat.tools.common import template_xmlui
7 from sat.core.log import getLogger 7 from sat.core.log import getLogger
8 log = getLogger('pages/ticket') 8 log = getLogger('pages/ticket')
9 import urllib
10 """ticket handling pages""" 9 """ticket handling pages"""
11 10
12 access = C.PAGES_ACCESS_PROFILE 11 access = C.PAGES_ACCESS_PROFILE
13 template = u"ticket/create.html" 12 template = u"ticket/create.html"
14 13
32 node = data['node'] 31 node = data['node']
33 posted_data = self.getAllPostedData(request) 32 posted_data = self.getAllPostedData(request)
34 profile = self.getProfile(request) 33 profile = self.getProfile(request)
35 yield self.host.bridge.ticketsSet(service.full(), node, posted_data, u'', u'', {}, profile) 34 yield self.host.bridge.ticketsSet(service.full(), node, posted_data, u'', u'', {}, profile)
36 # we don't want to redirect to creation page on success, but to tickets list 35 # we don't want to redirect to creation page on success, but to tickets list
37 data['post_redirect_uri'] = u'{list_url}/{service}/{node}'.format( 36 data['post_redirect_page'] = (self.getPageByName(u'tickets_list'),
38 service = urllib.quote_plus(service.full().encode('utf-8')), 37 service.full(),
39 node = urllib.quote_plus(node.encode('utf-8')) if node else u'@', 38 node or u'@')
40 list_url = self.getPageByName(u'tickets_list').url)