Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
db839e95
Commit
db839e95
authored
Feb 22, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Feb 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json] Fix invalid workflow dialog returning HTML instead of JSON
/reviewed-on
nexedi/erp5!586
parent
9f329a70
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
14 deletions
+132
-14
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+2
-11
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowError.xml
...s_ui_page_templates_zuite/testFormDialogWorkflowError.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowError.zpt
...s_ui_page_templates_zuite/testFormDialogWorkflowError.zpt
+69
-0
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.py
...em/portal_skins/erp5_xhtml_style/Workflow_statusModify.py
+3
-3
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
db839e95
...
...
@@ -48,19 +48,11 @@ if dialog_method == 'Base_configureSortOn':
selection_name
=
kw
[
'selection_name'
],
field_sort_on
=
kw
[
'field_sort_on'
],
field_sort_order
=
kw
[
'field_sort_order'
])
# Exceptions for Base_edit
# if dialog_method == 'Base_edit':
# return context.Base_edit(form_id=kw['form_id'],
# dialog_id=dialog_id,
# selection_name=kw['selection_name'])
# Exceptions for Workflow
if
dialog_method
==
'Workflow_statusModify'
:
value
=
context
.
Workflow_statusModify
(
form_id
=
kw
[
'form_id'
],
return
context
.
Workflow_statusModify
(
form_id
=
kw
[
'form_id'
],
dialog_id
=
dialog_id
)
# XXX: This test is related to erp5_web and should not be present in configuration where it is not installed.
#if not(getattr(context.REQUEST, 'ignore_layout', 0)) and context.getApplicableLayout() :
# context.REQUEST.RESPONSE.redirect(context.WebSite_getDocumentPhysicalPath())
return
value
# Exception for edit relation
if
dialog_method
==
'Base_editRelation'
:
return
context
.
Base_editRelation
(
form_id
=
kw
[
'form_id'
],
...
...
@@ -99,7 +91,6 @@ if not hasattr(form, 'validate_all_to_request'):
try
:
# It is necessary to force editable_mode before validating
# data. Otherwise, field appears as non editable.
# This is the pending of form_dialog.
editable_mode
=
request
.
get
(
'editable_mode'
,
1
)
request
.
set
(
'editable_mode'
,
1
)
form
.
validate_all_to_request
(
request
)
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowError.xml
0 → 100644
View file @
db839e95
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testFormDialogWorkflowError
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_page_templates_zuite/testFormDialogWorkflowError.zpt
0 → 100644
View file @
db839e95
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test Workflow Transition with Invalid Form
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test Workflow Transition with Invalid Form
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/PTZuite_CommonTemplate/macros/init"
/>
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/renderjs_runner/#/foo_module/1?editable=1
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//a[text()='Actions']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//a[text()='Actions']
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//a[@data-i18n='Custom Required Dialog']
</td>
<td></td>
</tr>
<tr>
<td>
click
</td>
<td>
//a[@data-i18n='Custom Required Dialog']
</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>
waitForElementPresent
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td></td>
</tr>
<!-- Do not fill anything to provoke form validation failure -->
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td><td></td></tr>
<tr><td>
assertText
</td>
<td>
//div[@data-gadget-scope="field_your_custom_workflow_variable"]/div/span
</td>
<td>
Input is required but no input given.
</td></tr>
<tr><td>
type
</td>
<td>
//textarea[@name='field_your_comment']
</td>
<td>
QWERTY
</td></tr>
<tr><td>
type
</td>
<td>
//input[@name='field_your_custom_workflow_variable']
</td>
<td>
YTREWQ
</td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog"
/>
<!-- 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. -->
<tal:block
tal:define=
"notification_configuration python: {'class': 'success',
'text': 'Status changed.'}"
>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification"
/>
</tal:block>
</tbody></table>
</body>
</html>
\ No newline at end of file
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Workflow_statusModify.py
View file @
db839e95
...
...
@@ -4,7 +4,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Log
import
log
portal
=
context
.
getPortalObject
()
request
=
context
.
REQUEST
request
=
kw
.
get
(
"REQUEST"
,
None
)
or
context
.
REQUEST
form
=
getattr
(
context
,
dialog_id
)
...
...
@@ -21,7 +21,7 @@ except FormValidationError, validation_errors:
# Pack errors into the request
field_errors
=
form
.
ErrorFields
(
validation_errors
)
request
.
set
(
'field_errors'
,
field_errors
)
return
form
(
request
)
return
context
.
Base_renderForm
(
dialog_id
)
# XXX: this is a duplication from form validation code in Base_callDialogMethod
# Correct fix is to factorise this script with Base_callDialogMethod, not to
...
...
@@ -81,7 +81,7 @@ except ValidationFailed, error_message:
# that would become an error.
log
(
"Status message has been truncated"
)
message
=
"%s ..."
%
message
[:(
2000
-
4
)]
except
WorkflowException
,
error_message
:
except
WorkflowException
as
error_message
:
if
str
(
error_message
)
==
"No workflow provides the '${action_id}' action."
:
message
=
translateString
(
"Workflow state may have been updated by other user. Please try again."
)
return
context
.
Base_redirect
(
form_id
,
keep_items
=
{
'portal_status_message'
:
message
},
**
kw
)
...
...
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