comparison libervia/server/pages.py @ 1374:25104d31479f

pages: `on_data_post` can now return `"continue"` string: if "continue" is returned, the page workflow is not interrupted with Post/Redirect/Get pattern.
author Goffi <goffi@goffi.org>
date Fri, 11 Dec 2020 17:35:03 +0100
parents 9bfd2d0661b2
children e943b0c8eec5
comparison
equal deleted inserted replaced
1373:2938d1b65bd5 1374:25104d31479f
1043 log.warning(_('Can\'t use cache for empty node without namespace ' 1043 log.warning(_('Can\'t use cache for empty node without namespace '
1044 'set, please ensure to set "short" and that it is ' 1044 'set, please ensure to set "short" and that it is '
1045 'registered')) 1045 'registered'))
1046 return 1046 return
1047 if profile != C.SERVICE_PROFILE: 1047 if profile != C.SERVICE_PROFILE:
1048 #  only service profile is cache for now 1048 #  only service profile is cached for now
1049 return 1049 return
1050 session_data = self.host.getSessionData(request, session_iface.ISATSession) 1050 session_data = self.host.getSessionData(request, session_iface.ISATSession)
1051 locale = session_data.locale 1051 locale = session_data.locale
1052 if locale == C.DEFAULT_LOCALE: 1052 if locale == C.DEFAULT_LOCALE:
1053 # no need to duplicate cache here 1053 # no need to duplicate cache here
1498 request.setResponseCode(C.HTTP_SEE_OTHER) 1498 request.setResponseCode(C.HTTP_SEE_OTHER)
1499 request.setHeader("location", request.uri) 1499 request.setHeader("location", request.uri)
1500 request.finish() 1500 request.finish()
1501 raise failure.Failure(exceptions.CancelError("Post/Redirect/Get is used")) 1501 raise failure.Failure(exceptions.CancelError("Post/Redirect/Get is used"))
1502 else: 1502 else:
1503 self._on_data_post_redirect(ret, request) 1503 if ret != "continue":
1504 self._on_data_post_redirect(ret, request)
1504 1505
1505 def getPostedData(self, request, keys, multiple=False, raise_on_missing=True): 1506 def getPostedData(self, request, keys, multiple=False, raise_on_missing=True):
1506 """Get data from a POST request or from URL's query part and decode it 1507 """Get data from a POST request or from URL's query part and decode it
1507 1508
1508 @param request(server.Request): request linked to the session 1509 @param request(server.Request): request linked to the session