Configure CMFDefault skins in a manner compatible with CMF 2.x since they're...

Configure CMFDefault skins in a manner compatible with CMF 2.x since they're no longer installable with addDirectoryViews() (approved by jerome)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29608 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0d0aaf94
...@@ -1686,12 +1686,40 @@ class ERP5Generator(PortalGenerator): ...@@ -1686,12 +1686,40 @@ class ERP5Generator(PortalGenerator):
""" """
pass pass
# this lists only the skin layers of Products.CMFDefault we are actually
# interested in.
CMFDEFAULT_FOLDER_LIST = [ 'zpt_content'
, 'zpt_generic'
, 'zpt_control'
, 'Images'
]
def addCMFDefaultDirectoryViews(self, p):
"""Semi-manually create DirectoryViews since CMFDefault 2.X no longer
registers the "skins" directory, only its subdirectories, making it
unusable with Products.CMFCore.DirectoryView.addDirectoryViews."""
from Products.CMFCore.DirectoryView import createDirectoryView
try:
from Products.CMFCore.DirectoryView import _generateKey
except ImportError:
# Still on CMF 1.x
from Products.CMFCore.DirectoryView import minimalpath
def _generateKey(package, subdir):
package_path = os.path.dirname(package.__file__)
return minimalpath(os.path.join(package_path, subdir))
import Products.CMFDefault
ps = getToolByName(p, 'portal_skins')
# get the layer directories actually present
for cmfdefault_skin_layer in self.CMFDEFAULT_FOLDER_LIST:
reg_key = _generateKey(Products.CMFDefault,
'skins/' + cmfdefault_skin_layer)
createDirectoryView(ps, reg_key)
def setupDefaultSkins(self, p): def setupDefaultSkins(self, p):
from Products.CMFCore.DirectoryView import addDirectoryViews from Products.CMFCore.DirectoryView import addDirectoryViews
from Products.CMFDefault import cmfdefault_globals
from Products.CMFActivity import cmfactivity_globals from Products.CMFActivity import cmfactivity_globals
ps = getToolByName(p, 'portal_skins') ps = getToolByName(p, 'portal_skins')
addDirectoryViews(ps, 'skins', cmfdefault_globals) self.addCMFDefaultDirectoryViews(p)
addDirectoryViews(ps, 'skins', cmfactivity_globals) addDirectoryViews(ps, 'skins', cmfactivity_globals)
ps.manage_addProduct['OFSP'].manage_addFolder(id='external_method') ps.manage_addProduct['OFSP'].manage_addFolder(id='external_method')
ps.manage_addProduct['OFSP'].manage_addFolder(id='custom') ps.manage_addProduct['OFSP'].manage_addFolder(id='custom')
...@@ -1701,14 +1729,7 @@ class ERP5Generator(PortalGenerator): ...@@ -1701,14 +1729,7 @@ class ERP5Generator(PortalGenerator):
skin_folder_list = [ 'custom' skin_folder_list = [ 'custom'
, 'external_method' , 'external_method'
, 'activity' , 'activity'
, 'zpt_content' ] + self.CMFDEFAULT_FOLDER_LIST
, 'zpt_generic'
, 'zpt_control'
, 'content'
, 'generic'
, 'control'
, 'Images'
]
skin_folders = ', '.join(skin_folder_list) skin_folders = ', '.join(skin_folder_list)
ps.addSkinSelection( 'View' ps.addSkinSelection( 'View'
, skin_folders , skin_folders
......
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