# HG changeset patch # User Goffi # Date 1509910349 -3600 # Node ID 12c1491711998ce283b6a83417174ae3bea1fbd3 # Parent 8f2c1ea36e96f2e852ee17a4f74e764c242254bf pages (data post): pages can now be redirected to a other uri than current page, using request.data['post_redirect_uri'] diff -r 8f2c1ea36e96 -r 12c149171199 src/server/server.py --- a/src/server/server.py Sun Nov 05 20:31:18 2017 +0100 +++ b/src/server/server.py Sun Nov 05 20:32:29 2017 +0100 @@ -1660,7 +1660,8 @@ def _on_data_post_redirect(self, ret, request): """called when page's on_data_post has been called successfuly - this method redirect to the same page, using Post/Redirect/Get pattern + this method redirect to the same page or to request.data['post_redirect_uri'] + if it is set, using Post/Redirect/Get pattern. HTTP status code "See Other" (303) is the recommanded code in this case @param ret(None, unicode, iterable): on_data_post return value see LiberviaPage.__init__ on_data_post docstring @@ -1676,7 +1677,7 @@ if not C.POST_NO_CONFIRM in ret: session_data.setPageFlag(self, C.FLAG_CONFIRM) request.setResponseCode(C.HTTP_SEE_OTHER) - request.setHeader("location", request.uri) + request.setHeader("location", request.data.get('post_redirect_uri', request.uri)) request.finish() raise failure.Failure(exceptions.CancelError(u'Post/Redirect/Get is used'))