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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
11235c56
Commit
11235c56
authored
Jun 26, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal_json_style] Submitting invalid dialog returns HTTP400 with field errors in response
parent
2e4891a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+15
-3
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.xml
...ortal_skins/erp5_hal_json_style/Base_callDialogMethod.xml
+1
-1
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
11235c56
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Generic method called when submitting a form in dialog mode.
Generic method called when submitting a form in dialog mode.
Responsible for validating form data and redirecting to the form action.
Responsible for validating form data and redirecting to the form action.
"""
"""
from
Products.ERP5Type.Log
import
log
from
Products.ERP5Type.Log
import
log
,
DEBUG
,
INFO
,
WARNING
# XXX We should not use meta_type properly,
# XXX We should not use meta_type properly,
# XXX We need to discuss this problem.(yusei)
# XXX We need to discuss this problem.(yusei)
...
@@ -18,7 +18,10 @@ def isListBox(field):
...
@@ -18,7 +18,10 @@ def isListBox(field):
from
Products.Formulator.Errors
import
FormValidationError
from
Products.Formulator.Errors
import
FormValidationError
from
ZTUtils
import
make_query
from
ZTUtils
import
make_query
request
=
container
.
REQUEST
request
=
REQUEST
if
REQUEST
is
None
:
request
=
container
.
REQUEST
request_form
=
request
.
form
request_form
=
request
.
form
error_message
=
''
error_message
=
''
...
@@ -96,7 +99,16 @@ except FormValidationError, validation_errors:
...
@@ -96,7 +99,16 @@ except FormValidationError, validation_errors:
# Pack errors into the request
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
return
form
(
request
)
# Make sure editors are pushed back as values into the REQUEST object
for
f
in
form
.
get_fields
():
field_id
=
f
.
id
if
request
.
has_key
(
field_id
):
value
=
request
.
get
(
field_id
)
if
callable
(
value
):
value
(
request
)
if
silent_mode
:
return
context
.
ERP5Document_getHateoas
(
form
=
form
,
REQUEST
=
request
,
mode
=
'form'
),
'form'
request
.
RESPONSE
.
setStatus
(
400
)
return
context
.
ERP5Document_getHateoas
(
form
=
form
,
REQUEST
=
request
,
mode
=
'form'
)
# Use REQUEST.redirect if possible. It will not be possible if at least one of these is true :
# Use REQUEST.redirect if possible. It will not be possible if at least one of these is true :
# * we got an import_file,
# * we got an import_file,
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.xml
View file @
11235c56
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
dialog_method, dialog_id, dialog_category=\'\', update_method=None, **kw
</string>
</value>
<value>
<string>
dialog_method, dialog_id, dialog_category=\'\', update_method=None,
REQUEST=None, silent_mode=0,
**kw
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
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