Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
erp5
Commits
f7e2adfe
Commit
f7e2adfe
authored
Feb 23, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Feb 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json_style] Set correct HTTP STATUS for invalid form while rendering
/reviewed-on
nexedi/erp5!593
parent
8f9f6ade
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderForm.py
...eItem/portal_skins/erp5_hal_json_style/Base_renderForm.py
+8
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderForm.xml
...Item/portal_skins/erp5_hal_json_style/Base_renderForm.xml
+1
-1
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowError.zpt
...s_ui_page_templates_zuite/testFormDialogWorkflowError.zpt
+4
-2
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderForm.py
View file @
f7e2adfe
# request.RESPONSE.setStatus(200)
form
=
getattr
(
context
,
form_id
)
form
=
getattr
(
context
,
form_id
)
request
=
REQUEST
or
context
.
REQUEST
# HAL JSON uses HTTP codes to communicate what the payload represents
if
request
.
get
(
'field_errors'
,
None
):
# HTTP400 means invalid form
request
.
RESPONSE
.
setStatus
(
400
)
return
context
.
ERP5Document_getHateoas
(
form
=
form
,
mode
=
'form'
)
return
context
.
ERP5Document_getHateoas
(
form
=
form
,
mode
=
'form'
)
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderForm.xml
View file @
f7e2adfe
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
form_id
</string>
</value>
<value>
<string>
form_id
, REQUEST=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowError.zpt
View file @
f7e2adfe
...
@@ -43,6 +43,9 @@
...
@@ -43,6 +43,9 @@
</tr>
</tr>
<!-- Do not fill anything to provoke form validation failure -->
<!-- Do not fill anything to provoke form validation failure -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tal:block
tal:define=
"notification_configuration python: {'class': 'error', 'text': 'Input data has errors.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
<tr><td>
waitForElementPresent
</td>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td><td></td></tr>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td><td></td></tr>
<tr><td>
assertText
</td>
<tr><td>
assertText
</td>
...
@@ -60,8 +63,7 @@
...
@@ -60,8 +63,7 @@
<!-- Wait for the notification to appear. We cannot use verifyText because the button
<!-- Wait for the notification to appear. We cannot use verifyText because the button
is there all the time. It gets text assigned and is shown asynchronously later. -->
is there all the time. It gets text assigned and is shown asynchronously later. -->
<tal:block
tal:define=
"notification_configuration python: {'class': 'success',
<tal:block
tal:define=
"notification_configuration python: {'class': 'success', 'text': 'Status changed.'}"
>
'text': 'Status changed.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
</tal:block>
</tbody></table>
</tbody></table>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment