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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
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
Show 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 @@
Generic method called when submitting a form in dialog mode.
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 need to discuss this problem.(yusei)
...
...
@@ -18,7 +18,10 @@ def isListBox(field):
from
Products.Formulator.Errors
import
FormValidationError
from
ZTUtils
import
make_query
request
=
container
.
REQUEST
request
=
REQUEST
if
REQUEST
is
None
:
request
=
container
.
REQUEST
request_form
=
request
.
form
error_message
=
''
...
...
@@ -96,7 +99,16 @@ except FormValidationError, validation_errors:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_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 :
# * 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 @@
</item>
<item>
<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>
<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