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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
fd91e074
Commit
fd91e074
authored
May 14, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
May 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[hal_json] Move more code to priviledged Script
parent
bfd0d733
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+6
-3
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Script_getParams.py
...Item/portal_skins/erp5_hal_json_style/Script_getParams.py
+6
-1
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
fd91e074
...
@@ -247,13 +247,16 @@ def selectKwargsForCallable(func, initial_kwargs, kwargs_dict):
...
@@ -247,13 +247,16 @@ def selectKwargsForCallable(func, initial_kwargs, kwargs_dict):
In case the function cannot state required arguments it throws an AttributeError.
In case the function cannot state required arguments it throws an AttributeError.
"""
"""
# TODO: replace `Script_getParams()` with `params()` when https://github.com/zopefoundation/Products.PythonScripts/pull/15 is merged
script_params
=
None
if
hasattr
(
func
,
'meta_type'
):
script_params
=
func
.
Script_getParams
()
if
hasattr
(
func
,
'params'
)
:
if
script_params
is
not
None
:
# In case the func is actualy Script (Python) or ERP5 Python Script
# In case the func is actualy Script (Python) or ERP5 Python Script
func_param_list
=
[
tuple
(
map
(
lambda
x
:
x
.
strip
(),
func_param
.
split
(
'='
)))
func_param_list
=
[
tuple
(
map
(
lambda
x
:
x
.
strip
(),
func_param
.
split
(
'='
)))
for
func_param
in
func
.
Script_getParams
()
.
split
(
","
)
for
func_param
in
script_params
.
split
(
","
)
if
func_param
.
strip
()]
if
func_param
.
strip
()]
elif
hasattr
(
func
,
"func_args"
):
elif
hasattr
(
func
,
"func_args"
):
# In case the func is an External Method
# In case the func is an External Method
func_param_list
=
func
.
func_args
func_param_list
=
func
.
func_args
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Script_getParams.py
View file @
fd91e074
return
context
.
params
()
try
:
if
"Script"
in
context
.
meta_type
:
return
context
.
params
()
return
None
except
AttributeError
:
return
None
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