Commit 7cc3d26d authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web] Desactivate the portal_skin URL parameter on Static Web Section

parent 32a7deb4
......@@ -34,11 +34,22 @@ from OFS.Traversable import NotFound
from Products.ERP5.mixin.extensible_traversable import DocumentExtensibleTraversableMixin
from Products.ERP5.Document.WebSection import WebSection
from Products.ERP5Type import Permissions
from Persistence import Persistent
from webdav.NullResource import NullResource
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):
"""
This Web Section only get resource from the DMS.
......@@ -49,6 +60,11 @@ class StaticWebSection(WebSection):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
def _getTraversalHookClass(self):
return StaticWebSectionTraversalHook
_traversal_hook_class = StaticWebSectionTraversalHook
def getExtensibleContent(self, request, name):
stack = request['TraversalRequestNameStack']
......
......@@ -170,6 +170,9 @@ class TestStaticWebSectionRedirection(ERP5TypeTestCase):
def test_queryStringIgnoreLayout(self):
self.runTestRedirect("?ignore_layout=1")
def test_queryStringPortalSkin(self):
self.runTestRedirect("?portal_skin=FOOBAR")
def test_plainRedirectGetId(self):
self.runTestRedirect("getId")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment