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
Joshua
erp5
Commits
7cc3d26d
Commit
7cc3d26d
authored
Apr 25, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web] Desactivate the portal_skin URL parameter on Static Web Section
parent
32a7deb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.StaticWebSection.py
...eItem/portal_components/document.erp5.StaticWebSection.py
+16
-0
bt5/erp5_web_ui_test/TestTemplateItem/portal_components/test.erp5.testStaticWebSiteRedirection.py
...rtal_components/test.erp5.testStaticWebSiteRedirection.py
+3
-0
No files found.
bt5/erp5_web/DocumentTemplateItem/portal_components/document.erp5.StaticWebSection.py
View file @
7cc3d26d
...
@@ -34,11 +34,22 @@ from OFS.Traversable import NotFound
...
@@ -34,11 +34,22 @@ from OFS.Traversable import NotFound
from
Products.ERP5.mixin.extensible_traversable
import
DocumentExtensibleTraversableMixin
from
Products.ERP5.mixin.extensible_traversable
import
DocumentExtensibleTraversableMixin
from
Products.ERP5.Document.WebSection
import
WebSection
from
Products.ERP5.Document.WebSection
import
WebSection
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Persistence
import
Persistent
from
webdav.NullResource
import
NullResource
from
webdav.NullResource
import
NullResource
MARKER
=
[]
MARKER
=
[]
class
StaticWebSectionTraversalHook
(
Persistent
):
"""Traversal hook to change the skin selection for this websection.
"""
def
__call__
(
self
,
container
,
request
):
if
not
request
.
get
(
'ignore_layout'
,
None
):
# If a skin selection is defined in this web section, change the skin now.
skin_selection_name
=
container
.
getSkinSelectionName
()
if
skin_selection_name
:
# and request.get('portal_skin', None) is None:
container
.
getPortalObject
().
changeSkin
(
skin_selection_name
)
class
StaticWebSection
(
WebSection
):
class
StaticWebSection
(
WebSection
):
"""
"""
This Web Section only get resource from the DMS.
This Web Section only get resource from the DMS.
...
@@ -49,6 +60,11 @@ class StaticWebSection(WebSection):
...
@@ -49,6 +60,11 @@ class StaticWebSection(WebSection):
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
security
.
declareObjectProtected
(
Permissions
.
AccessContentsInformation
)
def
_getTraversalHookClass
(
self
):
return
StaticWebSectionTraversalHook
_traversal_hook_class
=
StaticWebSectionTraversalHook
def
getExtensibleContent
(
self
,
request
,
name
):
def
getExtensibleContent
(
self
,
request
,
name
):
stack
=
request
[
'TraversalRequestNameStack'
]
stack
=
request
[
'TraversalRequestNameStack'
]
...
...
bt5/erp5_web_ui_test/TestTemplateItem/portal_components/test.erp5.testStaticWebSiteRedirection.py
View file @
7cc3d26d
...
@@ -170,6 +170,9 @@ class TestStaticWebSectionRedirection(ERP5TypeTestCase):
...
@@ -170,6 +170,9 @@ class TestStaticWebSectionRedirection(ERP5TypeTestCase):
def
test_queryStringIgnoreLayout
(
self
):
def
test_queryStringIgnoreLayout
(
self
):
self
.
runTestRedirect
(
"?ignore_layout=1"
)
self
.
runTestRedirect
(
"?ignore_layout=1"
)
def
test_queryStringPortalSkin
(
self
):
self
.
runTestRedirect
(
"?portal_skin=FOOBAR"
)
def
test_plainRedirectGetId
(
self
):
def
test_plainRedirectGetId
(
self
):
self
.
runTestRedirect
(
"getId"
)
self
.
runTestRedirect
(
"getId"
)
...
...
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