本文整理汇总了Python中Products.CMFCore.DirectoryView.createDirectoryView方法的典型用法代码示例。如果您正苦于以下问题:Python DirectoryView.createDirectoryView方法的具体用法?Python DirectoryView.createDirectoryView怎么用?Python DirectoryView.createDirectoryView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.CMFCore.DirectoryView
的用法示例。
在下文中一共展示了DirectoryView.createDirectoryView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_site
# 需要导入模块: from Products.CMFCore import DirectoryView [as 别名]
# 或者: from Products.CMFCore.DirectoryView import createDirectoryView [as 别名]
def setup_site(site):
# In 2.5, install the subtyper profile:
mt = cmfutils.getToolByName(site, 'portal_migration')
plone_version = mt.getInstanceVersion()
# Register profile for Plone 3.
if int(plone_version[0]) >= 3:
quickinstaller_tool = getToolByName(site, 'portal_quickinstaller')
quickinstaller_tool.installProduct('p4a.subtyper')
if plone_version[0:3] == '2.5':
# Setup only needed for Plone 3.0
skin_tool = cmfutils.getToolByName(site, 'portal_skins')
path = None
for path in DirectoryView.manage_listAvailableDirectories():
if path.endswith('p4a_subtyper'):
break
assert(path is None, "Subtyper skin directory not found")
if 'p4a_subtyper' not in skin_tool.objectIds():
DirectoryView.createDirectoryView(skin_tool, path)
for skin_name, paths in skin_tool.getSkinPaths():
if not 'p4a_subtyper' in paths:
paths = paths.split(',')
index = paths.index('plone_templates')
paths.insert(index, 'p4a_subtyper')
paths = ','.join(paths)
skin_tool._getSelections()[skin_name] = paths