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
Lukas Niegsch
erp5
Commits
3bba8c31
Commit
3bba8c31
authored
Oct 11, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_hal_json_style] Listbox: propagate checked uid list
parent
83022970
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+3
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+27
-0
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
3bba8c31
...
@@ -755,7 +755,9 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
...
@@ -755,7 +755,9 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
list_method_query_dict
,
list_method_query_dict
,
ignore_unknown_columns
=
True
).
asSearchTextExpression
(
sql_catalog
)})},
ignore_unknown_columns
=
True
).
asSearchTextExpression
(
sql_catalog
)})},
"domain_root_list"
:
[(
x
,
Base_translateString
(
y
))
for
x
,
y
in
field
.
get_value
(
"domain_root_list"
)],
"domain_root_list"
:
[(
x
,
Base_translateString
(
y
))
for
x
,
y
in
field
.
get_value
(
"domain_root_list"
)],
"selection_name"
:
field
.
get_value
(
'selection_name'
)
"selection_name"
:
field
.
get_value
(
'selection_name'
),
"checked_uid_list"
:
portal
.
portal_selections
.
getSelectionCheckedUidsFor
(
field
.
get_value
(
'selection_name'
))
})
})
result
[
"domain_dict"
]
=
getDomainSelection
([
x
[
0
]
for
x
in
result
[
"domain_root_list"
]])
result
[
"domain_dict"
]
=
getDomainSelection
([
x
[
0
]
for
x
in
result
[
"domain_root_list"
]])
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
3bba8c31
...
@@ -650,6 +650,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -650,6 +650,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'key'
],
'field_listbox'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'key'
],
'field_listbox'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'title'
],
'Foo Lines'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'title'
],
'Foo Lines'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'selection_name'
],
'foo_selection'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'selection_name'
],
'foo_selection'
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'checked_uid_list'
],
[])
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'lines'
],
3
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'lines'
],
3
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'editable'
],
1
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'editable'
],
1
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'show_anchor'
],
0
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'show_anchor'
],
0
)
...
@@ -1177,6 +1178,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
...
@@ -1177,6 +1178,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
key
'], '
x1_listbox
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
key
'], '
x1_listbox
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
title
'], '
Workflow
History
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
title
'], '
Workflow
History
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
selection_name
'], '
base_workflow_history_selection
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
selection_name
'], '
base_workflow_history_selection
')
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
checked_uid_list
'], [])
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
lines
'], 15)
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
lines
'], 15)
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
editable
'], 1)
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
editable
'], 1)
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
show_anchor
'], 0)
self.assertEqual(result_dict['
_embedded
']['
_view
']['
report_section_list
'][1]['
listbox
']['
show_anchor
'], 0)
...
@@ -2189,6 +2191,31 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
...
@@ -2189,6 +2191,31 @@ return context.getPortalObject().portal_catalog(portal_type='Foo', sort_on=[('id
{
'foo_category'
:
(
'portal_categories'
,
'foo_category/a/a2'
),
{
'foo_category'
:
(
'portal_categories'
,
'foo_category/a/a2'
),
'foo_domain'
:
(
'portal_domains'
,
'foo_domain/a/a1'
)})
'foo_domain'
:
(
'portal_domains'
,
'foo_domain/a/a1'
)})
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
'return "http://example.org/bar"'
)
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
'return "application/hal+json"'
)
@
changeSkin
(
'Hal'
)
def
test_getHateoas_selection_checked_uid_compatibility
(
self
):
document
=
self
.
_makeDocument
()
selection_tool
=
self
.
portal
.
portal_selections
selection_name
=
self
.
portal
.
foo_module
.
Foo_view
.
listbox
.
get_value
(
'selection_name'
)
selection_tool
.
setSelectionFor
(
selection_name
,
Selection
(
selection_name
))
selection_tool
.
setSelectionCheckedUidsFor
(
selection_name
,
[
9876
,
1234
])
fake_request
=
do_fake_request
(
"GET"
)
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"traverse"
,
relative_url
=
document
.
getRelativeUrl
(),
view
=
"view"
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
status
,
200
)
self
.
assertEquals
(
fake_request
.
RESPONSE
.
getHeader
(
'Content-Type'
),
"application/hal+json"
)
result_dict
=
json
.
loads
(
result
)
self
.
assertEqual
(
result_dict
[
'_links'
][
'self'
],
{
"href"
:
"http://example.org/bar"
})
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'selection_name'
],
selection_name
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'listbox'
][
'checked_uid_list'
],
[
9876
,
1234
])
class
TestERP5Person_getHateoas_mode_search
(
ERP5HALJSONStyleSkinsMixin
):
class
TestERP5Person_getHateoas_mode_search
(
ERP5HALJSONStyleSkinsMixin
):
"""Test HAL_JSON operations on cataloged Persons and other allowed content types of Person Module."""
"""Test HAL_JSON operations on cataloged Persons and other allowed content types of Person Module."""
...
...
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