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
0ea77886
Commit
0ea77886
authored
Aug 18, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! erp5_web: introduce translatable path.
parent
470188fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.WebSection.py
...emplateItem/portal_components/document.erp5.WebSection.py
+4
-3
bt5/erp5_web/TestTemplateItem/portal_components/test.erp5.testERP5Web.py
...stTemplateItem/portal_components/test.erp5.testERP5Web.py
+7
-1
No files found.
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.WebSection.py
View file @
0ea77886
...
@@ -461,9 +461,10 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
...
@@ -461,9 +461,10 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
parent
=
aq_parent
(
aq_inner
(
self
))
parent
=
aq_parent
(
aq_inner
(
self
))
parent_url
=
getattr
(
parent
,
'absolute_translated_url'
,
parent
.
absolute_url
)(
relative
=
relative
)
parent_url
=
getattr
(
parent
,
'absolute_translated_url'
,
parent
.
absolute_url
)(
relative
=
relative
)
original_document
=
self
.
getOriginalDocument
()
original_document
=
self
.
getOriginalDocument
()
return
self
.
_add_trailing_slash
(
return
'/'
.
join
([
self
.
_add_trailing_slash
(
parent_url
)
+
\
parent_url
,
getattr
(
original_document
,
'getTranslatedTranslatableId'
,
original_document
.
getId
)())
getattr
(
original_document
,
'getTranslatedTranslatableId'
,
original_document
.
getId
)()
])
security
.
declareProtected
(
Permissions
.
View
,
'getSiteMapTree'
)
security
.
declareProtected
(
Permissions
.
View
,
'getSiteMapTree'
)
def
getSiteMapTree
(
self
,
**
kw
):
def
getSiteMapTree
(
self
,
**
kw
):
...
...
bt5/erp5_web/TestTemplateItem/portal_components/test.erp5.testERP5Web.py
View file @
0ea77886
...
@@ -1626,6 +1626,7 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1626,6 +1626,7 @@ Hé Hé Hé!""", page.asText().strip())
# After setting /fr/ccc => /aaa as well, we have no conflict.
# After setting /fr/ccc => /aaa as well, we have no conflict.
section1
.
setFrTranslatedTranslatableId
(
'ccc'
)
section1
.
setFrTranslatedTranslatableId
(
'ccc'
)
self
.
tic
()
self
.
tic
()
website_absolute_url
=
website
.
absolute_url
()
website_path
=
website
.
absolute_url_path
()
website_path
=
website
.
absolute_url_path
()
# /fr/ccc/ is /aaa/
# /fr/ccc/ is /aaa/
response
=
self
.
publish
(
website_path
+
'/fr/ccc/'
)
response
=
self
.
publish
(
website_path
+
'/fr/ccc/'
)
...
@@ -1638,7 +1639,12 @@ Hé Hé Hé!""", page.asText().strip())
...
@@ -1638,7 +1639,12 @@ Hé Hé Hé!""", page.asText().strip())
# /fr/bbb/ should be redirected to /fr/aaa/
# /fr/bbb/ should be redirected to /fr/aaa/
response
=
self
.
publish
(
website_path
+
'/fr/bbb/'
)
response
=
self
.
publish
(
website_path
+
'/fr/bbb/'
)
self
.
assertEqual
(
MOVED_TEMPORARILY
,
response
.
status
)
self
.
assertEqual
(
MOVED_TEMPORARILY
,
response
.
status
)
self
.
assertEqual
(
website
.
absolute_url
()
+
'/fr/aaa/'
,
response
.
getHeader
(
'Location'
))
self
.
assertEqual
(
website_absolute_url
+
'/fr/aaa/'
,
response
.
getHeader
(
'Location'
))
# check absolute_translated_url()
with
self
.
portal
.
Localizer
.
translationContext
(
'fr'
):
self
.
assertEqual
(
website_absolute_url
+
'/fr'
,
website
.
absolute_translated_url
())
self
.
assertEqual
(
website_absolute_url
+
'/fr/ccc'
,
website
[
'aaa'
].
absolute_translated_url
())
self
.
assertEqual
(
website_absolute_url
+
'/fr/aaa'
,
website
[
'bbb'
].
absolute_translated_url
())
class
TestERP5WebWithSimpleSecurity
(
ERP5TypeTestCase
):
class
TestERP5WebWithSimpleSecurity
(
ERP5TypeTestCase
):
"""
"""
...
...
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