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
Alexander Emmerich
erp5
Commits
5bfb680a
Commit
5bfb680a
authored
Nov 10, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Fix double translation of worklist in ERP5JS
from
45c03413 (comment 171160)
See merge request
!1689
parents
59f1ea5b
52b25e02
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
21 deletions
+24
-21
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+5
-4
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+19
-17
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
5bfb680a
...
...
@@ -1546,10 +1546,11 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
'href'
:
'%s'
%
view_action
[
'url'
],
'name'
:
view_action
[
'id'
],
'icon'
:
view_action
[
'icon'
],
'title'
:
Base_translateString
(
translateWorklistActionName
(
view_action
[
'title'
])
if
'worklist_id'
in
view_action
else
view_action
[
'title'
]),
'title'
:
translateWorklistActionName
(
view_action
[
'title'
]
)
if
'worklist_id'
in
view_action
else
Base_translateString
(
view_action
[
'title'
]
),
})
global_action_type
=
(
"view"
,
"workflow"
,
"object_new_content_action"
,
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
5bfb680a
...
...
@@ -65,6 +65,7 @@ def simulate(script_id, params_string, code_string):
try
:
result
=
f
(
self
,
*
args
,
**
kw
)
finally
:
transaction
.
abort
()
if
script_id
in
self
.
portal
.
portal_skins
.
custom
.
objectIds
():
self
.
portal
.
portal_skins
.
custom
.
manage_delObjects
(
script_id
)
transaction
.
commit
()
...
...
@@ -159,18 +160,12 @@ def replace_request(new_request, context):
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
#####################################################
# Base_getRequestHeader
#####################################################
class
ERP5HALJSONStyleSkinsMixin
(
ERP5TypeTestCase
):
def
afterSetUp
(
self
):
self
.
login
()
wipeFolder
(
self
.
portal
.
foo_module
,
commit
=
False
)
def
beforeTearDown
(
self
):
transaction
.
abort
()
def
generateNewId
(
self
):
return
"%sö"
%
self
.
portal
.
portal_ids
.
generateNewId
(
id_group
=
(
'erp5_hal_json_style_test'
))
...
...
@@ -184,6 +179,10 @@ class ERP5HALJSONStyleSkinsMixin(ERP5TypeTestCase):
)
return
foo
#####################################################
# Base_getRequestHeader
#####################################################
class
TestBase_getRequestHeader
(
ERP5HALJSONStyleSkinsMixin
):
@
changeSkin
(
'Hal'
)
def
test_getRequestHeader_REQUEST_disallowed
(
self
):
...
...
@@ -2437,8 +2436,9 @@ class TestERP5Person_getHateoas_mode_search(ERP5HALJSONStyleSkinsMixin):
self
.
tic
()
def
beforeTearDown
(
self
):
super
(
TestERP5Person_getHateoas_mode_search
,
self
).
beforeTearDown
()
self
.
portal
.
person_module
.
deleteContent
(
self
.
person
.
getId
())
self
.
tic
()
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
'return "http://example.org/bar"'
)
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
'return "application/hal+json"'
)
...
...
@@ -2843,6 +2843,16 @@ if translation_service is not None :\n\
pass
\
n
\
return msg"
def
afterSetUp
(
self
):
super
(
TestERP5Document_getHateoas_translation
,
self
).
afterSetUp
()
self
.
portal
.
Base_createUITestLanguages
()
param_dict
=
[
{
'message'
:
'Title'
,
'translation'
:
'biaoti'
,
'language'
:
'wo'
},
{
'message'
:
'Draft To Validate'
,
'translation'
:
'daiyanzhen'
,
'language'
:
'wo'
},
{
'message'
:
'Foo'
,
'translation'
:
'Foo_zhongwen'
,
'language'
:
'wo'
}]
for
tmp
in
param_dict
:
self
.
portal
.
Base_addUITestTranslation
(
message
=
tmp
[
'message'
],
translation
=
tmp
[
'translation'
],
language
=
tmp
[
'language'
])
@
simulate
(
'Base_getRequestUrl'
,
'*args, **kwargs'
,
'return "http://example.org/bar"'
)
@
simulate
(
'Base_getRequestHeader'
,
'*args, **kwargs'
,
...
...
@@ -2852,13 +2862,6 @@ return msg"
@
changeSkin
(
'Hal'
)
def
test_getHateoasBulk_default_view_translation
(
self
):
self
.
portal
.
Base_createUITestLanguages
()
param_dict
=
[
{
'message'
:
'Title'
,
'translation'
:
'biaoti'
,
'language'
:
'wo'
},
{
'message'
:
'Draft To Validate'
,
'translation'
:
'daiyanzhen'
,
'language'
:
'wo'
},
{
'message'
:
'Foo'
,
'translation'
:
'Foo_zhongwen'
,
'language'
:
'wo'
}]
for
tmp
in
param_dict
:
self
.
portal
.
Base_addUITestTranslation
(
message
=
tmp
[
'message'
],
translation
=
tmp
[
'translation'
],
language
=
tmp
[
'language'
])
document
=
self
.
_makeDocument
()
fake_request
=
do_fake_request
(
"POST"
)
...
...
@@ -2942,9 +2945,8 @@ return msg"
# worklists with the actual count of document
fake_request
=
do_fake_request
(
"GET"
)
default_gettext
=
self
.
portal
.
Localizer
.
erp5_ui
.
gettext
def
gettext
(
message
,
**
kw
):
return
default_gettext
(
message
,
**
kw
)
return
kw
.
get
(
'default'
,
message
)
with
mock
.
patch
.
object
(
self
.
portal
.
Localizer
.
erp5_ui
.
__class__
,
'gettext'
,
side_effect
=
gettext
)
as
gettext_mock
:
self
.
portal
.
web_site_module
.
hateoas
.
ERP5Document_getHateoas
(
...
...
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