Mercurial > libervia-web
changeset 1032:863cc6f97068
pages: path arguments can now be specified in pageRedirect
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 22 Jan 2018 22:18:47 +0100 |
parents | 4ba7df23b976 |
children | c34f08e05cdf |
files | src/server/pages.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/server/pages.py Mon Jan 22 22:17:20 2018 +0100 +++ b/src/server/pages.py Mon Jan 22 22:18:47 2018 +0100 @@ -727,7 +727,7 @@ else: self.HTTPRedirect(request, url) - def pageRedirect(self, page_path, request, skip_parse_url=True): + def pageRedirect(self, page_path, request, skip_parse_url=True, path_args=None): """redirect a page to a named page the workflow will continue with the workflow of the named page, @@ -744,6 +744,7 @@ "/common/blog/atom.xml" redirect to the page at the fiven full path @param request(server.Request): current HTTP request @param skip_parse_url(bool): if True, parse_url method on redirect page will be skipped + @param path_args(list[unicode], None): path arguments to use in redirected page @raise KeyError: there is no known page with this name """ # FIXME: render non LiberviaPage resources @@ -759,6 +760,10 @@ else: redirect_page = redirect_page.original.children[subpage] + if path_args is not None: + args = [quote(a) for a in path_args] + request.postpath = args + request.postpath + redirect_page.renderPage(request, skip_parse_url=skip_parse_url) raise failure.Failure(exceptions.CancelError(u'page redirection is used'))