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
Alexander Emmerich
erp5
Commits
cb7601e9
Commit
cb7601e9
authored
Apr 25, 2022
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: BusinessTemplate_getPythonSourceCodeMessageList.
parent
c07c85ec
Changes
1
Hide 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 @
cb7601e9
"""Return python source code in business template
"""
import
json
import
six
class
Message
:
"""A python code linter message, with a link to edit the source code.
...
...
@@ -50,11 +51,14 @@ def checkPythonScript(script_instance, script_path):
# RestrictedPython.Utilities.utility_builtins
extra_builtins
=
[
'printed'
,
'same_type'
,
'string'
,
'sequence'
,
'random'
,
'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
(
{
'bound_names'
:
extra_builtins
+
script_instance
.
getBindingAssignments
().
getAssignedNamesInOrder
(),
'params'
:
script_instance
.
params
(),
'code'
:
unicode
(
script_instance
.
body
(),
'utf8'
)
'code'
:
code
}))[
'annotations'
]:
annotation
[
"script_path"
]
=
script_path
line_list
.
append
(
...
...
@@ -74,8 +78,11 @@ def checkComponent(component_instance):
message
=
consistency_message
.
getMessage
().
translate
(),
edit_url
=
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
(
{
'code'
:
unicode
(
component_instance
.
getTextContent
(),
'utf8'
)
}))[
'annotations'
]:
{
'code'
:
code
}))[
'annotations'
]:
annotation
[
'component_path'
]
=
component_relative_url
line_list
.
append
(
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