Commit 7d0ddac3 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Support changing a skin selection based on the property skin_selection_name in a Web Site.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21910 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d661959b
......@@ -54,7 +54,7 @@ class WebSiteTraversalHook(Persistent):
Remove the path to the VirtualRoot from a physical path
and add the path to the WebSite if any
"""
if type(path) is type(''):
if isinstance(path, str):
path = path.split( '/')
# Every Web Section acts as a mini site though layout for document editing is the root layout
......@@ -98,11 +98,16 @@ class WebSiteTraversalHook(Persistent):
def __call__(self, container, request):
"""
Each time we are traversed, we patch the request instance with our
rewritted version of physicalPathToVirtualPath
own version of physicalPathToVirtualPath
"""
self._v_request = request
request.physicalPathToVirtualPath = self._physicalPathToVirtualPath
# If a skin selection is defined in this web site, change the skin now.
skin_selection_name = container.getSkinSelectionName()
if skin_selection_name:
container.getPortalObject().changeSkin(skin_selection_name)
class WebSite(WebSection):
"""
The Web Site root class is specialises WebSection
......@@ -124,6 +129,7 @@ class WebSite(WebSection):
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.WebSection
, PropertySheet.WebSite
, PropertySheet.Predicate
)
......@@ -205,4 +211,4 @@ class WebSite(WebSection):
# Sort by Index
section_list.sort(lambda x,y: cmp(x.getIntIndex(), y.getIntIndex()))
return section_list
\ No newline at end of file
return section_list
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