本文整理汇总了Python中Products.CMFCore.DirectoryView类的典型用法代码示例。如果您正苦于以下问题:Python DirectoryView类的具体用法?Python DirectoryView怎么用?Python DirectoryView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DirectoryView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
def initialize(context):
import Warenkorb
import SimpleProduct
import DefaultProduct
# Register skin directory
DirectoryView.registerDirectory("skins", globals())
content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME)
utils.ContentInit(
PROJECTNAME + " Warenkorb",
content_types=content_types,
permission=ADD_CONTENT_PERMISSION,
extra_constructors=constructors,
fti=ftis,
).initialize(context)
utils.ContentInit(
PROJECTNAME + " Simple Product",
content_types=content_types,
permission=ADD_CONTENT_PERMISSION,
extra_constructors=constructors,
fti=ftis,
).initialize(context)
utils.ContentInit(
PROJECTNAME + " Default Product",
content_types=content_types,
permission=ADD_CONTENT_PERMISSION,
extra_constructors=constructors,
fti=ftis,
).initialize(context)
示例2: setup_site
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
示例3: initialize
def initialize(context):
"""Initializer called when used as a Zope 2 product.
"""
import easyshop.search.content
# Register skin directory
DirectoryView.registerDirectory('skins', globals())
示例4: initialize
def initialize(context):
"""Initializer called when used as a Zope 2 product."""
# Register Plone skins directory
from Products.CMFCore import DirectoryView
GLOBALS = globals()
DirectoryView.registerDirectory('skins', GLOBALS)
示例5: initialize
def initialize(context):
"""
"""
from Products.CMFCore import DirectoryView
# This is required.
# For some reason you cannot register a skin
# directory for a non-theme product through
# zcml
DirectoryView.registerDirectory('skins', globals())
示例6: initialize
def initialize(context):
"""Initializer called when used as a Zope 2 product.
"""
DirectoryView.registerDirectory('skins', globals())
# register profile
profile_registry.registerProfile(
name = 'default',
title = 'EasyShopSkins',
description = 'Skinsfolder for EasyShop for Plone 2.5',
path = 'profiles/default',
product = 'EasyShopSkins',
profile_type = EXTENSION,
for_ = IPloneSiteRoot)
示例7: initialize
def initialize(context):
"""Initializer called when used as a Zope 2 product.
This is referenced from configure.zcml. Regstrations as a "Zope 2 product"
is necessary for GenericSetup profiles to work, for example.
Here, we call the Archetypes machinery to register our content types
with Zope and the CMF.
"""
# Register Plone skins directory
from Products.CMFCore import DirectoryView
GLOBALS = globals()
DirectoryView.registerDirectory('skins', GLOBALS)
# Retrieve the content types that have been registered with Archetypes
# This happens when the content type is imported and the registerType()
# call in the content type's module is invoked. Actually, this happens
# during ZCML processing, but we do it here again to be explicit. Of
# course, even if we import the module several times, it is only run
# once.
content_types, constructors, ftis = atapi.process_types(
atapi.listTypes(config.PROJECTNAME),
config.PROJECTNAME)
# Now initialize all these content types. The initialization process takes
# care of registering low-level Zope 2 factories, including the relevant
# add-permission. These are listed in config.py. We use different
# permissions for each content type to allow maximum flexibility of who
# can add which content types, where. The roles are set up in rolemap.xml
# in the GenericSetup profile.
for atype, constructor in zip(content_types, constructors):
utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
content_types = (atype,),
permission = config.ADD_PERMISSIONS[atype.portal_type],
extra_constructors = (constructor,),
).initialize(context)
示例8: initialize
def initialize(context):
"""initialize product (called by zope)"""
import VwireLens
import config
import setuphandlers
from Products.Archetypes.atapi import process_types
from Products.Archetypes.atapi import listTypes
from Products.CMFCore import utils
from Products.CMFCore import DirectoryView
DirectoryView.registerDirectory('skins', config.product_globals)
content_types, constructors, ftis = process_types(
listTypes(config.PROJECTNAME),
config.PROJECTNAME)
utils.ContentInit(
"%s Content" % config.PROJECTNAME,
content_types = content_types,
permission = config.ADD_CONTENT_PERMISSIONS['VwireLens'],
extra_constructors = constructors,
fti = ftis,
).initialize(context)
示例9: globals
## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from os.path import join
import logging
LOG = logging.getLogger("TagCloudExplorer")
from Products.CMFCore import DirectoryView
from Products.CMFCore import utils
from config import *
import tool
## Register our directory in Zope
DirectoryView.registerDirectory("skins", globals())
## Save the globals for use in the Plone Quick Installer
GLOBALS = globals()
TOOL = tool.TagCloudExplorerTool
def initialize(context):
## Register our tool
utils.ToolInit(
"%s's Tool" % PROJECT_NAME,
tools=(TOOL,),
icon= join(SKIN_MAIN, ICON),
).initialize(context)
示例10: globals
from Products.CMFCore import utils, DirectoryView
from Products.Archetypes.atapi import *
from Products.Archetypes import listTypes
ADD_CONTENT_PERMISSION = """Add FAQ content"""
PROJECTNAME = "FAQ"
product_globals = globals()
DirectoryView.registerDirectory("skins", product_globals)
DirectoryView.registerDirectory("skins/faq", product_globals)
def initialize(context):
##Import Types here to register them (were removed by pyflake check!)
import FAQ
import FAQQuestion
content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME)
utils.ContentInit(
PROJECTNAME + " Content",
content_types=content_types,
permission=ADD_CONTENT_PERMISSION,
extra_constructors=constructors,
fti=ftis,
).initialize(context)
示例11: initialize
import logging
logger = logging.getLogger('BungeniHelpCenter')
logger.info('Installing Product')
import os, os.path
from Globals import package_home
from Products.CMFCore import utils as cmfutils
from Products.CMFCore import permissions as cmfpermissions
from Products.CMFCore import DirectoryView
from Products.CMFPlone.utils import ToolInit
from Products.Archetypes.atapi import *
from Products.Archetypes import listTypes
from Products.Archetypes.utils import capitalize
from config import *
DirectoryView.registerDirectory('skins', product_globals)
DirectoryView.registerDirectory('skins/bungeni_help_center',
product_globals)
from Products.CMFPlone.interfaces import IPloneSiteRoot
from Products.GenericSetup import EXTENSION, profile_registry
import monkeypatch
def initialize(context):
##code-section custom-init-top #fill in your manual code here
##/code-section custom-init-top
# imports packages and types for registration
import content
import interfaces
示例12: Copyright
# Copyright (c) 2004-2006 by BlueDynamics Alliance - Klein & Partner KEG, Austria
#
# BSD-like licence, see LICENCE.txt
#
import os
from Globals import package_home
from Products.CMFCore import utils as cmfutils
from Products.CMFCore import DirectoryView
from Products.Archetypes.atapi import *
from Products.Archetypes.utils import capitalize
from Products.ATVocabularyManager.config import *
from Products.ATVocabularyManager.namedvocabulary import NamedVocabulary
DirectoryView.registerDirectory(SKINS_DIR, GLOBALS)
DirectoryView.registerDirectory(os.path.join(SKINS_DIR, 'ATVocabularyManager'),
GLOBALS)
def initialize(context):
##Import Types here to register them
import types
import tools
import utils
content_types, constructors, ftis = process_types(listTypes(PROJECTNAME),
PROJECTNAME)
cmfutils.ToolInit( PROJECTNAME+' Tools',
tools = [tools.VocabularyLibrary],
icon='tool.gif'
示例13: MessageFactory
## CMF imports
from Products.CMFCore.utils import ContentInit
from Products.CMFCore import permissions, DirectoryView
from Products.CMFCore.utils import registerIcon
from zope.i18nmessageid import MessageFactory
PloneGazetteFactory = MessageFactory('plonegazette')
## App imports
import NewsletterTheme, Newsletter, Subscriber, Section, NewsletterTopic
from config import PROJECTNAME
from config import product_globals
DirectoryView.registerDirectory('skins', product_globals)
DirectoryView.registerDirectory('skins/PloneGazette', product_globals)
## Types to register
contentConstructors = (Newsletter.addNewsletter, Subscriber.addSubscriber, NewsletterTopic.addNewsletterTopic)
contentClasses = (Newsletter.Newsletter, Subscriber.Subscriber, NewsletterTopic.NewsletterTopic)
factoryTypes = (Newsletter.Newsletter.factory_type_information,
Subscriber.Subscriber.factory_type_information,
NewsletterTopic.NewsletterTopic.factory_type_information)
## Patches to apply
import patches
def initialize(context):
示例14: _updateFromFS
self._readMetadata()
def _updateFromFS(self):
# workaround for Python 2.1 multiple inheritance lameness
return self._baseUpdateFromFS()
def _readMetadata(self):
# workaround for Python 2.1 multiple inheritance lameness
return self._baseReadMetadata()
def __call__(self, *args, **kwargs):
return self._call(FSPageTemplate.__call__, *args, **kwargs)
InitializeClass(FSPageTemplate)
InitializeClass(FSControllerPageTemplate)
DirectoryView.registerFileExtension('pt', FSPageTemplate)
DirectoryView.registerFileExtension('zpt', FSPageTemplate)
DirectoryView.registerFileExtension('html', FSPageTemplate)
DirectoryView.registerFileExtension('htm', FSPageTemplate)
DirectoryView.registerFileExtension('cpt', FSControllerPageTemplate)
DirectoryView.registerMetaType('Page Template', FSPageTemplate)
DirectoryView.registerMetaType('Controller Page Template', FSControllerPageTemplate)
# Patch the ignore list, so that our .py source files don't show up in skins
# folders
old_ignore = DirectoryView.ignore_re
new_ignore_re = re.compile(r'\.|(.*~$)|#|(.*\.(.?pt|htm.?)\.py$)')
DirectoryView.ignore_re = new_ignore_re
示例15: initialize
from Products.Archetypes.public import process_types, listTypes
# Products imports
import config
from Products.PloneArticle.pafti import PloneArticleFactoryTypeInformation
from Products.PloneArticle.pafti import manage_addPAFTIForm
from Products.PloneArticle.pafti import DynamicAllowedContentFTI
from Products.PloneArticle.pafti import manage_addDVTFTIForm
from Products.PloneArticle import content, proxy
from Products.PloneArticle import tool
from Products.PloneArticle import migration
# Register skin directories so they can be added to portal_skins
DirectoryView.registerDirectory('skins', config.GLOBALS)
def initialize(context):
# Setup migrations
migration.executeMigrations()
migration.registerMigrations()
# optional demo content
if config.INSTALL_EXAMPLES:
import examples
# register the fti
context.registerClass(
PloneArticleFactoryTypeInformation,
permission=ManagePortal,