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
Titouan Soulard
erp5
Commits
dd10ac56
Commit
dd10ac56
authored
Nov 22, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_form: fix raises on validation errors and when missing after method
parent
b032c93c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
bt5/erp5_json_form/ModuleComponentTemplateItem/portal_components/document.erp5.JSONForm.py
...tTemplateItem/portal_components/document.erp5.JSONForm.py
+3
-3
No files found.
bt5/erp5_json_form/ModuleComponentTemplateItem/portal_components/document.erp5.JSONForm.py
View file @
dd10ac56
...
@@ -63,14 +63,14 @@ class JSONForm(JSONType, TextDocument):
...
@@ -63,14 +63,14 @@ class JSONForm(JSONType, TextDocument):
)
)
def
__call__
(
self
,
json_data
,
list_error
=
False
):
#pylint:disable=arguments-differ
def
__call__
(
self
,
json_data
,
list_error
=
False
):
#pylint:disable=arguments-differ
validation_result
=
self
.
validateJSON
(
json_data
,
list_error
)
data_dict
=
json
.
loads
(
json_data
)
validation_result
=
self
.
validateJSON
(
data_dict
,
list_error
)
if
validation_result
is
not
True
:
if
validation_result
is
not
True
:
if
not
list_error
:
if
not
list_error
:
raise
jsonschema
.
exceptions
.
ValidationError
(
validation_result
.
message
)
raise
jsonschema
.
exceptions
.
ValidationError
(
validation_result
.
message
)
else
:
else
:
raise
ValueError
(
json
.
dumps
(
validation_result
))
raise
ValueError
(
json
.
dumps
(
validation_result
))
data_dict
=
json
.
loads
(
json_data
)
if
self
.
getAfterMethodId
():
if
self
.
getAfterMethodId
():
after_method
=
getattr
(
getattr
(
self
,
"aq_parent"
,
None
),
self
.
getAfterMethodId
())
after_method
=
getattr
(
getattr
(
self
,
"aq_parent"
,
None
),
self
.
getAfterMethodId
())
mapped_data_dict
=
self
.
_mapArguments
(
data_dict
,
"input"
)
mapped_data_dict
=
self
.
_mapArguments
(
data_dict
,
"input"
)
...
@@ -82,7 +82,7 @@ class JSONForm(JSONType, TextDocument):
...
@@ -82,7 +82,7 @@ class JSONForm(JSONType, TextDocument):
mapped_output_dict
=
self
.
_mapArguments
(
output_dict
,
"output"
)
mapped_output_dict
=
self
.
_mapArguments
(
output_dict
,
"output"
)
return
json
.
dumps
(
mapped_output_dict
)
return
json
.
dumps
(
mapped_output_dict
)
r
eturn
"Nothing to do"
r
aise
NotImplementedError
(
"No after method"
)
def
_mapArguments
(
self
,
arguments
,
mapping_type
):
def
_mapArguments
(
self
,
arguments
,
mapping_type
):
mappings
=
{
x
.
getSource
():
x
.
getDestination
()
for
x
in
self
.
objectValues
(
portal_type
=
"Argument Mapping"
)
if
x
.
getMappingType
()
==
mapping_type
}
mappings
=
{
x
.
getSource
():
x
.
getDestination
()
for
x
in
self
.
objectValues
(
portal_type
=
"Argument Mapping"
)
if
x
.
getMappingType
()
==
mapping_type
}
...
...
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