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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
cde69e3d
Commit
cde69e3d
authored
Dec 03, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal_json_style] No need to fetch getListItemUrlDict for every columns
parent
c2c28029
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+19
-11
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
cde69e3d
...
@@ -1778,6 +1778,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1778,6 +1778,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
'value'
:
brain_uid
'value'
:
brain_uid
}
}
is_getListItemUrlDict_calculated
=
False
for
select
in
select_list
:
for
select
in
select_list
:
contents_item
[
select
]
=
{}
contents_item
[
select
]
=
{}
editable_field
=
editable_field_dict
.
get
(
select
,
None
)
editable_field
=
editable_field_dict
.
get
(
select
,
None
)
...
@@ -1821,6 +1823,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1821,6 +1823,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if
select
in
url_column_dict
:
if
select
in
url_column_dict
:
# Check if we get URL parameters using listbox field `url_columns`
# Check if we get URL parameters using listbox field `url_columns`
try
:
try
:
# XXX call on aq_base?
url_column_method
=
getattr
(
brain
,
url_column_dict
[
select
])
url_column_method
=
getattr
(
brain
,
url_column_dict
[
select
])
# Result of `url_column_method` must be a dictionary in the format
# Result of `url_column_method` must be a dictionary in the format
# {'command': <command_name, ex: 'raw', 'push_history'>,
# {'command': <command_name, ex: 'raw', 'push_history'>,
...
@@ -1838,17 +1841,22 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1838,17 +1841,22 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if
url_column_dict
[
select
]:
if
url_column_dict
[
select
]:
log
(
"Invalid URL method {!s} on column {}"
.
format
(
url_column_dict
[
select
],
select
),
level
=
800
)
log
(
"Invalid URL method {!s} on column {}"
.
format
(
url_column_dict
[
select
],
select
),
level
=
800
)
elif
getattr
(
brain
,
'getListItemUrlDict'
,
None
)
is
not
None
:
else
:
# Check if we can get URL result from the brain
if
not
is_getListItemUrlDict_calculated
:
try
:
# XXX If only available on brains, maybe better to call on aq_self
url_parameter_dict
=
brain
.
getListItemUrlDict
(
getBrainListItemUrlDict
=
getattr
(
brain
,
'getListItemUrlDict'
,
None
)
select
,
result_index
,
catalog_kw
[
'selection_name'
]
is_getListItemUrlDict_calculated
=
True
)
if
getBrainListItemUrlDict
is
not
None
:
except
(
ConflictError
,
RuntimeError
):
# Check if we can get URL result from the brain
raise
try
:
except
:
url_parameter_dict
=
getBrainListItemUrlDict
(
log
(
'could not evaluate the url method getListItemUrlDict with %r'
%
brain
,
select
,
result_index
,
catalog_kw
[
'selection_name'
]
level
=
800
)
)
except
(
ConflictError
,
RuntimeError
):
raise
except
:
log
(
'could not evaluate the url method getListItemUrlDict with %r'
%
brain
,
level
=
800
)
if
isinstance
(
url_parameter_dict
,
dict
):
if
isinstance
(
url_parameter_dict
,
dict
):
# We need to put URL into rendered field so just ensure it is a dict
# We need to put URL into rendered field so just ensure it is a dict
...
...
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