# HG changeset patch # User Goffi # Date 1516655927 -3600 # Node ID 863cc6f97068c00a09cd0c7f621535f5483b5391 # Parent 4ba7df23b97680379c586930203db8f746f430dc pages: path arguments can now be specified in pageRedirect diff -r 4ba7df23b976 -r 863cc6f97068 src/server/pages.py --- 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'))