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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
9cfa98bb
Commit
9cfa98bb
authored
Jan 06, 2023
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Plain Diff
erp5_hal_json_style: get last form from correct document
See merge request
nexedi/erp5!1718
parents
507feceb
f0fe8121
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-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
+1
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+22
-0
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
9cfa98bb
...
...
@@ -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 @
9cfa98bb
...
...
@@ -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'
,
...
...
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