# HG changeset patch # User Goffi # Date 1592578071 -7200 # Node ID 65c43eec15adf490b10f767f1894d3434a40a413 # Parent 436ef2ad92af70de72436be667d3dbd64a2787f5 pages: `on_data_post` can be set to the string `continue` instead of a callable: if `on_data_post` == "continue", then request won't be stopped if `POST` method is used, and `render` method can be used to handle it. diff -r 436ef2ad92af -r 65c43eec15ad libervia/server/pages.py --- a/libervia/server/pages.py Fri Jun 19 16:47:51 2020 +0200 +++ b/libervia/server/pages.py Fri Jun 19 16:47:51 2020 +0200 @@ -160,7 +160,9 @@ This method is mutually exclusive with render @param on_data_post(callable, None): method to call when data is posted None if data post is not handled - on_data_post can return a string with following value: + "continue" if data post is not handled there, and we must not interrupt + workflow (i.e. it's handled in "render" method). + otherwise, on_data_post can return a string with following value: - C.POST_NO_CONFIRM: confirm flag will not be set on_data_post can raise following exceptions: - exceptions.DataError: value is incorrect, message will be displayed @@ -1680,8 +1682,6 @@ .format(theme=theme, vhost=self.vhost_root))) else: session_data.theme = theme - - try: try: @@ -1713,7 +1713,9 @@ self.pageError(request, C.HTTP_BAD_REQUEST) if request.method == C.HTTP_METHOD_POST: - if self.on_data_post is None: + if self.on_data_post == 'continue': + pass + elif self.on_data_post is None: # if we don't have on_data_post, the page was not expecting POST # so we return an error self.pageError(request, C.HTTP_BAD_REQUEST)