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
Labels
Merge Requests
138
Merge Requests
138
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
a174c0ce
Commit
a174c0ce
authored
Feb 21, 2020
by
Romain Courteaud
Committed by
Gabriel Monnerat
Aug 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: cast select_list before handling group_by
parent
4b02aaab
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 @
a174c0ce
...
@@ -1644,6 +1644,12 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1644,6 +1644,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
...
@@ -1780,12 +1786,6 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1780,12 +1786,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 @
a174c0ce
...
@@ -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