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): ...@@ -54,7 +54,7 @@ class WebSiteTraversalHook(Persistent):
Remove the path to the VirtualRoot from a physical path Remove the path to the VirtualRoot from a physical path
and add the path to the WebSite if any and add the path to the WebSite if any
""" """
if type(path) is type(''): if isinstance(path, str):
path = path.split( '/') path = path.split( '/')
# Every Web Section acts as a mini site though layout for document editing is the root layout # Every Web Section acts as a mini site though layout for document editing is the root layout
...@@ -98,11 +98,16 @@ class WebSiteTraversalHook(Persistent): ...@@ -98,11 +98,16 @@ class WebSiteTraversalHook(Persistent):
def __call__(self, container, request): def __call__(self, container, request):
""" """
Each time we are traversed, we patch the request instance with our Each time we are traversed, we patch the request instance with our
rewritted version of physicalPathToVirtualPath own version of physicalPathToVirtualPath
""" """
self._v_request = request self._v_request = request
request.physicalPathToVirtualPath = self._physicalPathToVirtualPath 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): class WebSite(WebSection):
""" """
The Web Site root class is specialises WebSection The Web Site root class is specialises WebSection
...@@ -124,6 +129,7 @@ class WebSite(WebSection): ...@@ -124,6 +129,7 @@ class WebSite(WebSection):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.WebSection , PropertySheet.WebSection
, PropertySheet.WebSite
, PropertySheet.Predicate , PropertySheet.Predicate
) )
...@@ -205,4 +211,4 @@ class WebSite(WebSection): ...@@ -205,4 +211,4 @@ class WebSite(WebSection):
# Sort by Index # Sort by Index
section_list.sort(lambda x,y: cmp(x.getIntIndex(), y.getIntIndex())) section_list.sort(lambda x,y: cmp(x.getIntIndex(), y.getIntIndex()))
return section_list return section_list
\ No newline at end of file
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