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
Paul Graydon
erp5
Commits
8f5321b7
Commit
8f5321b7
authored
Feb 21, 2020
by
Romain Courteaud
Committed by
Xiaowu Zhang
Apr 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: cast select_list before handling group_by
parent
42689f4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
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
-6
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+3
-3
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
8f5321b7
...
@@ -1641,6 +1641,12 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1641,6 +1641,12 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
count_method
=
source_field
.
get_value
(
'count_method'
)
count_method
=
source_field
.
get_value
(
'count_method'
)
has_listbox_a_count_method
=
(
count_method
!=
""
)
and
(
count_method
.
getMethodName
()
!=
list_method
)
has_listbox_a_count_method
=
(
count_method
!=
""
)
and
(
count_method
.
getMethodName
()
!=
list_method
)
# Cast to list if only one element is provided
if
select_list
is
None
:
select_list
=
[]
elif
same_type
(
select_list
,
""
):
select_list
=
[
select_list
]
# hardcoded responses for site and portal objects (which are not Documents!)
# hardcoded responses for site and portal objects (which are not Documents!)
# we let the flow to continue because the result of a list_method call can
# we let the flow to continue because the result of a list_method call can
# be similar - they can in practice return anything
# be similar - they can in practice return anything
...
@@ -1777,12 +1783,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1777,12 +1783,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
REQUEST
.
set
(
k
,
v
)
REQUEST
.
set
(
k
,
v
)
search_result_iterable
=
callable_list_method
(
**
catalog_kw
)
search_result_iterable
=
callable_list_method
(
**
catalog_kw
)
# Cast to list if only one element is provided
if
select_list
is
None
:
select_list
=
[]
elif
same_type
(
select_list
,
""
):
select_list
=
[
select_list
]
# extract form field definition into `editable_field_dict`
# extract form field definition into `editable_field_dict`
editable_field_dict
=
{}
editable_field_dict
=
{}
url_column_dict
=
{}
url_column_dict
=
{}
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
8f5321b7
...
@@ -1461,9 +1461,9 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
...
@@ -1461,9 +1461,9 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
def test_getHateoas_group_by_param(self):
def test_getHateoas_group_by_param(self):
fake_request = do_fake_request("GET")
fake_request = do_fake_request("GET")
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas(REQUEST=fake_request, mode="search",
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas(REQUEST=fake_request, mode="search",
select_list=
['
count
(
*
)
']
,
select_list=
'
count
(
*
)
'
,
query='
portal_type
:
"Base Category"',
query='
portal_type
:
"Base Category"',
group_by=
["portal_type"]
)
group_by=
"portal_type"
)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('
Content
-
Type
'),
self.assertEquals(fake_request.RESPONSE.getHeader('
Content
-
Type
'),
"application/hal+json"
"application/hal+json"
...
@@ -1476,7 +1476,7 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
...
@@ -1476,7 +1476,7 @@ class TestERP5Document_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['
_query
'], '
portal_type
:
"Base Category"')
self.assertEqual(result_dict['
_query
'], '
portal_type
:
"Base Category"')
self.assertEqual(result_dict['
_local_roles
'], None)
self.assertEqual(result_dict['
_local_roles
'], None)
self.assertEqual(result_dict['
_select_list
'], ['
count
(
*
)
'])
self.assertEqual(result_dict['
_select_list
'], ['
count
(
*
)
'])
self.assertEqual(result_dict['
_group_by
'],
["portal_type"]
)
self.assertEqual(result_dict['
_group_by
'],
"portal_type"
)
self.assertEqual(result_dict['
_sort_on
'], None)
self.assertEqual(result_dict['
_sort_on
'], None)
self.assertEqual(len(result_dict['
_embedded
']['
contents
']), 1)
self.assertEqual(len(result_dict['
_embedded
']['
contents
']), 1)
...
...
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