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
Klaus Wölfel
erp5
Commits
e8300329
Commit
e8300329
authored
Apr 25, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: Port BusinessTemplate_getPythonSourceCodeMessageList.
parent
0d617cbf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getPythonSourceCodeMessageList.py
...5_core/BusinessTemplate_getPythonSourceCodeMessageList.py
+9
-2
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/BusinessTemplate_getPythonSourceCodeMessageList.py
View file @
e8300329
"""Return python source code in business template
"""Return python source code in business template
"""
"""
import
json
import
json
import
six
class
Message
:
class
Message
:
"""A python code linter message, with a link to edit the source code.
"""A python code linter message, with a link to edit the source code.
...
@@ -50,11 +51,14 @@ def checkPythonScript(script_instance, script_path):
...
@@ -50,11 +51,14 @@ def checkPythonScript(script_instance, script_path):
# RestrictedPython.Utilities.utility_builtins
# RestrictedPython.Utilities.utility_builtins
extra_builtins
=
[
'printed'
,
'same_type'
,
'string'
,
'sequence'
,
'random'
,
extra_builtins
=
[
'printed'
,
'same_type'
,
'string'
,
'sequence'
,
'random'
,
'DateTime'
,
'whrandom'
,
'reorder'
,
'sets'
,
'test'
,
'math'
]
'DateTime'
,
'whrandom'
,
'reorder'
,
'sets'
,
'test'
,
'math'
]
code
=
script_instance
.
body
()
if
six
.
PY2
:
code
=
unicode
(
code
,
'utf8'
)
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
{
'bound_names'
:
extra_builtins
+
{
'bound_names'
:
extra_builtins
+
script_instance
.
getBindingAssignments
().
getAssignedNamesInOrder
(),
script_instance
.
getBindingAssignments
().
getAssignedNamesInOrder
(),
'params'
:
script_instance
.
params
(),
'params'
:
script_instance
.
params
(),
'code'
:
unicode
(
script_instance
.
body
(),
'utf8'
)
'code'
:
code
}))[
'annotations'
]:
}))[
'annotations'
]:
annotation
[
"script_path"
]
=
script_path
annotation
[
"script_path"
]
=
script_path
line_list
.
append
(
line_list
.
append
(
...
@@ -74,8 +78,11 @@ def checkComponent(component_instance):
...
@@ -74,8 +78,11 @@ def checkComponent(component_instance):
message
=
consistency_message
.
getMessage
().
translate
(),
message
=
consistency_message
.
getMessage
().
translate
(),
edit_url
=
component_relative_url
,
edit_url
=
component_relative_url
,
jio_key
=
component_relative_url
,),)
jio_key
=
component_relative_url
,),)
code
=
component_instance
.
getTextContent
()
if
six
.
PY2
:
code
=
unicode
(
code
,
'utf8'
)
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
for
annotation
in
json
.
loads
(
portal
.
ERP5Site_checkPythonSourceCodeAsJSON
(
{
'code'
:
unicode
(
component_instance
.
getTextContent
(),
'utf8'
)
}))[
'annotations'
]:
{
'code'
:
code
}))[
'annotations'
]:
annotation
[
'component_path'
]
=
component_relative_url
annotation
[
'component_path'
]
=
component_relative_url
line_list
.
append
(
line_list
.
append
(
Message
(
Message
(
...
...
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