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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
6c56e746
Commit
6c56e746
authored
Jan 07, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
354cbfd4
c1b70e3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+1
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+22
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getListbox.py
...kinTemplateItem/portal_skins/erp5_core/Base_getListbox.py
+1
-2
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
6c56e746
...
...
@@ -997,7 +997,7 @@ def renderForm(traversed_document, form, response_dict, key_prefix=None, selecti
# ... so we can do some magic with it (especially embedded listbox if exists)!
try
:
if
last_form_id
:
last_form
=
getattr
(
contex
t
,
last_form_id
)
last_form
=
getattr
(
traversed_documen
t
,
last_form_id
)
last_listbox
=
last_form
.
Base_getListbox
()
except
AttributeError
:
pass
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
6c56e746
...
...
@@ -1076,6 +1076,28 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self
.
assertIn
(
"dialog_id"
,
field_names
)
# no need for dialog_method because that one is hardcoded in javascript
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
'return "application/hal+json"'
)
@
changeSkin
(
'Hal'
)
def
test_getHateoasDocument_last_form_rendering_context
(
self
):
self
.
portal
.
foo_module
.
FooModule_viewFooList
.
listbox
.
manage_tales_xmlrpc
(
dict
(
selection_name
=
'python: "foo_selection" if here.getPortalType()=="Foo Module" else "wrong_selection"'
))
fake_request
=
do_fake_request
(
"GET"
)
result
=
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"traverse"
,
relative_url
=
self
.
portal
.
foo_module
.
getRelativeUrl
(),
view
=
"create_a_document"
,
extra_param_json
=
{
"form_id"
:
"FooModule_viewFooList"
}
)
self
.
assertEqual
(
fake_request
.
RESPONSE
.
status
,
200
)
self
.
assertEqual
(
fake_request
.
RESPONSE
.
getHeader
(
'Content-Type'
),
"application/hal+json"
)
result_dict
=
json
.
loads
(
result
)
self
.
assertEqual
(
result_dict
[
'_embedded'
][
'_view'
][
'selection_name'
][
'default'
],
'foo_selection'
)
self
.
portal
.
foo_module
.
FooModule_viewFooList
.
listbox
.
manage_tales_xmlrpc
(
dict
(
selection_name
=
''
))
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
'return "http://example.org/bar"'
)
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_getListbox.py
View file @
6c56e746
...
...
@@ -46,6 +46,5 @@ if listbox:
for
group
in
(
'bottom'
,
'center'
,
'left'
,
'right'
):
for
field
in
form
.
get_fields_in_group
(
group
):
if
(
isListBox
(
field
)
and
not
field
.
get_value
(
'hidden'
)
and
field
.
get_value
(
'enabled'
)):
not
field
.
get_value
(
'hidden'
)):
return
field
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