def uninstall(self): out = StringIO() classes=listTypes(PROJECTNAME) #unregister folderish classes in use_folder_contents props=getToolByName(self,'portal_properties').site_properties use_folder_tabs=list(props.use_folder_tabs) print >> out, 'removing classes from use_folder_tabs:' for cl in classes: print >> out, 'type:', cl['klass'].portal_type if cl['klass'].isPrincipiaFolderish and not cl['klass'].portal_type in []: if cl['klass'].portal_type in use_folder_tabs: use_folder_tabs.remove(cl['klass'].portal_type) props.use_folder_tabs=tuple(use_folder_tabs) if TOOL_META in self.portal_properties.navtree_properties.metaTypesNotToList: self.portal_properties.navtree_properties._p_changed=1 mtntl = list(self.portal_properties.navtree_properties.metaTypesNotToList) mtntl.remove(TOOL_META) self.portal_properties.navtree_properties.metaTypesNotToList = tuple(mtntl) # unregister tool in control panel portal_controlpanel=getToolByName(self, 'portal_controlpanel') portal_controlpanel.unregisterConfiglet(TOOL_NAME) return out.getvalue()
def initialize(context): "" from content.country import Country from content.region import Region from controlpanel.bika_cultivars import Cultivars from content.cultivar import Cultivar from controlpanel.bika_regions import Regions from controlpanel.bika_winetypes import WineTypes from content.winetype import WineType from controlpanel.bika_transportconditions import TransportConditions from content.transportcondition import TransportCondition from controlpanel.bika_storageconditions import StorageConditions from content.storagecondition import StorageCondition content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type) perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type, ADD_CONTENT_PERMISSION) ContentInit( kind, content_types=(atype, ), permission=perm, extra_constructors=(constructor, ), fti=ftis, ).initialize(context)
def installAdditionalCatalogIndexes(context): if isNotSeminarPortalProfile(context): return try: import Products.QueueCatalog except ImportError: HAS_QUEUECATALOG = False else: HAS_QUEUECATALOG = True if HAS_QUEUECATALOG: # This step borks everything if QueueCatalog is installed. return indexes = [] site = context.getSite() catalogTool = getToolByName(site, 'portal_catalog') for indexName, indexType in ADDITIONAL_CATALOG_INDEXES: indexes.append(indexName) if indexName not in catalogTool.indexes(): catalogTool.addIndex(indexName, indexType) FSDTypes = [t['meta_type'] for t in listTypes(PROJECTNAME)] for brain in catalogTool(portal_type=FSDTypes): try: brain.getObject().reindexObject(indexes) except KeyError: # Relations content objects seem to not be able to handle # getObject(), but the data doesn't seem to get lost, so just # ignore it. pass
def initialize(context): # from Products.validation import validation # validation.register(validators.CourseNumberValidator('CourseNumberValidator')) # 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)
def initialize(context): from Products.CompositePack import viewlet from Products.CompositePack.composite import archetype from Products.CompositePack.composite import fragments from Products.CompositePack.composite import navigationpage from Products.CompositePack.composite import portlets from Products.CompositePack.composite import titles from Products.CompositePack.viewlet import container if config.INSTALL_DEMO_TYPES: from Products.CompositePack.demo import ATCompositeDocument 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_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context) utils.ToolInit(config.TOOL_NAME, tools=tools, icon=config.TOOL_ICON, ).initialize(context)
def initialize(context): validation.register(validators.ProjectIdValidator('isNonConflictingProjectId')) validation.register(validators.ProjectContactValidator('isValidContact')) # Kick content registration and sys.modules mangling from Products.PloneSoftwareCenter import content allTypes = listTypes(config.PROJECTNAME) # Register Archetypes content with the machinery content_types, constructors, ftis = process_types( allTypes, config.PROJECTNAME) center_content_types = [] center_constructors = [] project_content_types = [] project_constructors = [] member_content_types = [] member_constructors = [] for i in range(len(allTypes)): aType = allTypes[i] if aType['klass'].meta_type in ('PloneSoftwareCenter',): center_content_types.append(content_types[i]) center_constructors.append(constructors[i]) elif aType['klass'].meta_type in ('PSCProject',): project_content_types.append(content_types[i]) project_constructors.append(constructors[i]) else: member_content_types.append(content_types[i]) member_constructors.append(constructors[i]) # software center itself ContentInit( config.PROJECTNAME + ' Center', content_types = tuple(center_content_types), permission = psc_permissions.AddSoftwareCenter, extra_constructors = tuple(center_constructors), fti = ftis, ).initialize(context) # projects ContentInit( config.PROJECTNAME + ' Project', content_types = tuple(project_content_types), permission = psc_permissions.AddProject, extra_constructors = tuple(project_constructors), fti = ftis, ).initialize(context) # regular content ContentInit( config.PROJECTNAME + ' Project Content', content_types = tuple(member_content_types), permission = permissions.AddPortalContent, extra_constructors = tuple(member_constructors), fti = ftis, ).initialize(context)
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. """ # 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)
def initialize(context): "" from content.country import Country from content.region import Region from controlpanel.bika_cultivars import Cultivars from content.cultivar import Cultivar from controlpanel.bika_regions import Regions from controlpanel.bika_winetypes import WineTypes from content.winetype import WineType from controlpanel.bika_transportconditions import TransportConditions from content.transportcondition import TransportCondition from controlpanel.bika_storageconditions import StorageConditions from content.storagecondition import StorageCondition content_types, constructors, ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type) perm = ADD_CONTENT_PERMISSIONS.get( atype.portal_type, ADD_CONTENT_PERMISSION) ContentInit(kind, content_types=(atype,), permission = perm, extra_constructors = (constructor,), fti = ftis, ).initialize(context)
def initialize(context): """initialize product (called by zope)""" # import packages and types for registration # I really don't think I have to do these imports. from content import Subsite from content import CountySite from content import Section from content import Blog from content import HomePage from content import Newsletter from content import PhotoFolder from content import FormConfirmationPage content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) # Initialize the various content types 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)
def initialize(context): """Initializer called when used as a Zope 2 product.""" #from pmr2.app.workspace import content from pmr2.app.workspace.pas import protocol content_types, constructors, ftis = atapi.process_types( atapi.listTypes('pmr2.app.workspace'), 'pmr2.app.workspace') cmfutils.ContentInit( 'pmr2.app.workspace Content', content_types = content_types, permission = ADD_CONTENT_PERMISSION, extra_constructors = constructors, fti = ftis, ).initialize(context) registerMultiPlugin(protocol.ProtocolAuthPlugin.meta_type) context.registerClass( protocol.ProtocolAuthPlugin, constructors = ( #protocol.manage_addProtocolAuthPluginForm, protocol.addProtocolAuthPlugin, ), visibility = None )
def initialize(context): """Intializer called when used as a Zope 2 product.""" # 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('archetypes.z3crelationfield'), 'archetypes.z3crelationfield') # 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): cmfutils.ContentInit('%s: %s' % ('archetypes.z3crelationfield', atype.portal_type), content_types = (atype, ), permission = 'Add portal content', extra_constructors = (constructor,), ).initialize(context)
def initialize(context): # Importing the content types allows for their registration # with the Archetypes runtime import content import tools types = listTypes(PROJECTNAME) content_types, constructors, ftis = \ process_types(types, PROJECTNAME) tools=[tools.admanager.AdManager, tools.adcatalog.AdCatalog] cmf_utils.ToolInit(PROJECTNAME+' Tools', tools = tools, icon='tool.gif' ).initialize(context) permissions = initialize_permissions() allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: %s" % (PROJECTNAME, atype.archetype_name) cmf_utils.ContentInit( kind, content_types = (atype,), permission = permissions[atype.portal_type], extra_constructors = (constructor,), fti = ftis, ).initialize(context) registerClasses(context, PROJECTNAME)
def initialize(context): """Initializer called when used as a Zope 2 product.""" logger.info("*** Initializing BHP LIMS Customization Package ***") from content.courier import Courier # noqa from content.couriers import Couriers # noqa from bhp.lims.content.barcodeprinter import BarcodePrinter # noqa from bhp.lims.controlpanel.barcodeprinters import BarcodePrinters # noqa types = listTypes(PRODUCT_NAME) content_types, constructors, ftis = process_types(types, PRODUCT_NAME) # Register each type with it's own Add permission # use ADD_CONTENT_PERMISSION as default allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: Add %s" % (PRODUCT_NAME, atype.portal_type) ContentInit( kind, content_types=(atype, ), permission=AddPortalContent, extra_constructors=(constructor, ), fti=ftis, ).initialize(context)
def initialize(context): from intranett.policy import config config.config.register_profile() config.config.register_profile(profile_name='content') config.config.scan() from AccessControl import allow_module allow_module('intranett.policy.config') from Products.Archetypes import atapi from Products.CMFCore import utils # Register content from intranett.policy.content import membersfolder from intranett.policy.content import projectroom membersfolder # pyflakes projectroom # pyflakes content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) 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)
def initialize(context): """ initializer called when used as a zope2 product """ try: from Products.Archetypes import atapi from plone.app.folder import folder except ImportError: pass else: from Products.CMFCore import utils folder.__name__ # make pyflakes happy... content_types, constructors, ftis = atapi.process_types( atapi.listTypes(packageName), packageName) assert len(content_types) == 1, 'only one new folder, please!' for atype, constructor, fti in zip(content_types, constructors, ftis): utils.ContentInit( '%s: %s' % (packageName, atype.portal_type), content_types=(atype, ), permission=AddFolder, extra_constructors=(constructor, ), fti=(fti, ), ).initialize(context) from plone.app.folder import nogopip context.registerClass(nogopip.GopipIndex, permission='Add Pluggable Index', constructors=(nogopip.manage_addGopipForm, nogopip.manage_addGopipIndex), icon='www/index.gif', visibility=None)
def gen_class(klass, schema=None): """generats and registers the klass """ if schema is not None: klass.schema = schema.copy() registerType(klass, 'Archetypes') content_types, constructors, ftis = process_types(listTypes(), PKG_NAME)
def initialize(context): """ initializer called when used as a zope2 product """ try: from Products.Archetypes import atapi from plone.app.folder import folder except ImportError: pass else: from Products.CMFCore import utils folder.__name__ # make pyflakes happy... content_types, constructors, ftis = atapi.process_types( atapi.listTypes(packageName), packageName) assert len(content_types) == 1, 'only one new folder, please!' for atype, constructor, fti in zip(content_types, constructors, ftis): utils.ContentInit('%s: %s' % (packageName, atype.portal_type), content_types = (atype,), permission = AddFolder, extra_constructors = (constructor,), fti = (fti,), ).initialize(context) from plone.app.folder import nogopip context.registerClass(nogopip.GopipIndex, permission = 'Add Pluggable Index', constructors = (nogopip.manage_addGopipForm, nogopip.manage_addGopipIndex), icon = 'www/index.gif', visibility = None)
def initialize(context): # from Products.validation import validation # validation.register(validators.CourseNumberValidator('CourseNumberValidator')) # 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)
def initialize(context): """ Zope 2 """ # Register AT Content-Types atapi.registerType(NavigationManager.NavigationManager, PROJECTNAME) atapi.registerType(NavigationItem.NavigationItem, PROJECTNAME) # Register custom content-types content_types, constructors, ftis = atapi.process_types( atapi.listTypes(PROJECTNAME), PROJECTNAME) # Initialize portal tools cmfutils.ToolInit( PROJECTNAME +' Tools', tools=(NavigationManager.NavigationManager,), icon='tool.gif' ).initialize(context) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission="Add portal content", extra_constructors=constructors, fti=ftis).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" logger.info("*** Initializing SENAITE QUEUE Customization package ***") types = listTypes(PRODUCT_NAME) content_types, constructors, ftis = process_types(types, PRODUCT_NAME) # Register each type with it's own Add permission # use ADD_CONTENT_PERMISSION as default all_types = zip(content_types, constructors) for a_type, constructor in all_types: kind = "%s: Add %s" % (PRODUCT_NAME, a_type.portal_type) ContentInit( kind, content_types=(a_type, ), permission=AddPortalContent, extra_constructors=(constructor, ), fti=ftis, ).initialize(context) # Register Queue's PAS plugin from pasplugin import QueueAuthPlugin PluggableAuthService.registerMultiPlugin(QueueAuthPlugin.meta_type) context.registerClass( QueueAuthPlugin, permission=manage_users, constructors=(add_queue_auth_plugin, ), )
def initialize(context): """ initializer called when used as a zope2 product """ # setup non-anonymous file uploads from plone.app.blob import monkey monkey.__name__ # make pyflakes happy... # initialize portal content from plone.app.blob import content content.__name__ # make pyflakes happy... from Products.CMFCore import utils from Products.Archetypes import atapi from Products.ATContentTypes import permission as atct content_types, constructors, ftis = atapi.process_types( atapi.listTypes(packageName), packageName) for atype, constructor in zip(content_types, constructors): utils.ContentInit("%s: %s" % (packageName, atype.portal_type), content_types = (atype,), permission = permissions[atype.portal_type], extra_constructors = (constructor,), ).initialize(context) replacement_types = ( ('File', content.addATBlobFile), ('Image', content.addATBlobImage), ) for name, constructor in replacement_types: utils.ContentInit("%s: %s" % (packageName, name), content_types = (content.ATBlob,), permission = atct.permissions.get(name), extra_constructors = (constructor,), ).initialize(context)
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. """ # 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)
def initialize(context): from Products.CompositePack import viewlet from Products.CompositePack.composite import archetype from Products.CompositePack.composite import fragments from Products.CompositePack.composite import navigationpage from Products.CompositePack.composite import portlets from Products.CompositePack.composite import titles from Products.CompositePack.viewlet import container if config.INSTALL_DEMO_TYPES: from Products.CompositePack.demo import ATCompositeDocument 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_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context) utils.ToolInit( config.TOOL_NAME, tools=tools, icon=config.TOOL_ICON, ).initialize(context)
def initialize(context): """Intializer called when used as a Zope 2 product.""" # 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('archetypes.z3crelationfield'), 'archetypes.z3crelationfield') # 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): cmfutils.ContentInit( '%s: %s' % ('archetypes.z3crelationfield', atype.portal_type), content_types=(atype, ), permission='Add portal content', extra_constructors=(constructor, ), ).initialize(context)
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. """ from content.intranetfolder import IntranetFolder # noqa content_types, constructors, ftis = process_types( 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): ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor,), ).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" from content.shipment import Shipment from content.shipments import Shipments from content.kittemplate import KitTemplate from content.biospectype import BiospecType from content.biospecimen import Biospecimen from content.multimage import Multimage from content.storagetype import StorageType from content.kit import Kit from content.kits import Kits from content.project import Project from content.projects import Projects from content.biospecimens import Biospecimens from content.inventoryorder import InventoryOrder from content.inventoryorderfolder import InventoryOrderFolder from content.product import Product from content.stockitem import StockItem from content.storageunit import StorageUnit from content.storageunits import StorageUnits from content.managedstorage import ManagedStorage from content.unmanagedstorage import UnmanagedStorage from content.storageposition import StoragePosition from content.donor import SampleDonor from content.donors import SampleDonors from content.disease_ontology import DiseaseOntology from content.disease_ontologies import DiseaseOntologies from content.sampleshipment import SampleShipment from content.sampleshipments import SampleShipments from content.samplebatch import SampleBatch from content.samplebatches import SampleBatches from controlpanel.bika_kittemplates import KitTemplates from controlpanel.bika_biospectypes import BiospecTypes from controlpanel.bika_storagetypes import StorageTypes from controlpanel.bika_products import Products from controlpanel.bika_stockitems import StockItems content_types, constructors, ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) # Register each type with it's own Add permission # use ADD_CONTENT_PERMISSION as default allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: Add %s" % (PROJECTNAME, atype.portal_type) perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type, ADD_CONTENT_PERMISSION) ContentInit(kind, content_types = (atype,), permission = perm, extra_constructors = (constructor,), fti = ftis, ).initialize(context)
def initialize(context): # Kick content registration and sys.modules mangling from Products.PloneSoftwareCenter import content content # pyflakes allTypes = listTypes(config.PROJECTNAME) # Register Archetypes content with the machinery content_types, constructors, ftis = process_types( allTypes, config.PROJECTNAME) center_content_types = [] center_constructors = [] project_content_types = [] project_constructors = [] member_content_types = [] member_constructors = [] for i in range(len(allTypes)): aType = allTypes[i] if aType['klass'].meta_type in ('PloneSoftwareCenter',): center_content_types.append(content_types[i]) center_constructors.append(constructors[i]) elif aType['klass'].meta_type in ('PSCProject',): project_content_types.append(content_types[i]) project_constructors.append(constructors[i]) else: member_content_types.append(content_types[i]) member_constructors.append(constructors[i]) # software center itself ContentInit( config.PROJECTNAME + ' Center', content_types=tuple(center_content_types), permission=psc_permissions.AddSoftwareCenter, extra_constructors=tuple(center_constructors), fti=ftis, ).initialize(context) # projects ContentInit( config.PROJECTNAME + ' Project', content_types=tuple(project_content_types), permission=psc_permissions.AddProject, extra_constructors=tuple(project_constructors), fti=ftis, ).initialize(context) # regular content ContentInit( config.PROJECTNAME + ' Project Content', content_types=tuple(member_content_types), permission=cmf_permissions.AddPortalContent, extra_constructors=tuple(member_constructors), fti=ftis, ).initialize(context)
def afterSetUp(self): self.setRoles(['Manager']) self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema) self.article = makeContent(self.portal, 'PloneArticle', id='article') typeInfo = [ti for ti in listTypes(PROJECTNAME) if ti['name'] == 'SimpleSmartContent'] dummy_out = StringIO() installTypes(self.portal, dummy_out, typeInfo, PROJECTNAME)
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. >>> from collective.realestatebroker import initialize >>> class MockContext: ... def registerClass(*args, **kw): ... pass >>> context = MockContext() >>> initialize(context) """ # 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! from content import residential from content import commercial residential, commercial # pyflakes 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 # permisisons 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): cmfutils.ContentInit( "%s: %s" % (config.PROJECTNAME, atype.portal_type), content_types = (atype,), permission = config.ADD_PERMISSIONS[atype.portal_type], extra_constructors = (constructor,), ).initialize(context) # Add an extra scaling size to the ATImage scaling list image_sizes = ATImage.schema['image'].sizes if not image_sizes.has_key('tile96'): image_sizes['tile96'] = (96,96) ATImage.schema['image'].sizes = image_sizes ATImage.schema['image'].original_size = (768,768)
def initialize(context): content_types, constructors, ftis = atapi.process_types(atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) 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)
def initialize(context): """Initializer called when used as a Zope 2 product.""" content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) 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)
def initialize(context): '''Initializer called when used as a Zope 2 product.''' from content import studyfolder, protocol contentTypes, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(contentTypes, constructors): Products.CMFCore.utils.ContentInit( '%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor, )).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" from content import rdffolder, bodysystem, disease, site, publication, protocol, registeredperson, committee contentTypes, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(contentTypes, constructors): Products.CMFCore.utils.ContentInit( '%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor, )).initialize(context)
def initialize(context): content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) 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)
def initialize(context): content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) utils.ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission=ADD_PERMISSION, extra_constructors=constructors, fti=ftis,).initialize(context)
def initialize(context): import demo content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) ContentInit( PROJECTNAME + " Content", content_types=content_types, permission=AddPortalContent, extra_constructors=constructors, ).initialize(context)
def initialize(context): '''Initializer called when used as a Zope 2 product.''' from content import datasetfolder, dataset contentTypes, constructors, ftis = atapi.process_types(atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(contentTypes, constructors): Products.CMFCore.utils.ContentInit( '%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype,), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor,) ).initialize(context)
def afterSetUp(self): ATSiteTestCase.afterSetUp(self) registerType(Dummy, "Archetypes") content_types, constructors, ftis = process_types(listTypes(), PKG_NAME) portal = self.portal dummy = Dummy(oid="dummy") # put dummy in context of portal dummy = dummy.__of__(portal) portal.dummy = dummy dummy.initializeArchetype() self._dummy = dummy
def initialize(context): from content.aetiologicagent import AetiologicAgent from content.caseoutcome import CaseOutcome from content.casestatus import CaseStatus from content.ethnicity import Ethnicity from content.casesyndromicclassification import CaseSyndromicClassification from content.disease import Disease from content.doctor import Doctor from content.doctors import Doctors from content.drug import Drug from content.drugprohibition import DrugProhibition from content.epidemiologicalyear import EpidemiologicalYear from content.identifiertype import IdentifierType from content.immunization import Immunization from content.insurancecompany import InsuranceCompany from content.patient import Patient from content.patients import Patients from content.symptom import Symptom from content.treatment import Treatment from content.vaccinationcenter import VaccinationCenter from content.vaccinationcentercontact import VaccinationCenterContact from controlpanel.bika_aetiologicagents import AetiologicAgents from controlpanel.bika_caseoutcomes import CaseOutcomes from controlpanel.bika_casesyndromicclassifications import CaseSyndromicClassifications from controlpanel.bika_casestatuses import CaseStatuses from controlpanel.bika_diseases import Diseases from controlpanel.bika_drugprohibitions import DrugProhibitions from controlpanel.bika_drugs import Drugs from controlpanel.bika_epidemiologicalyears import EpidemiologicalYears from controlpanel.bika_identifiertypes import IdentifierTypes from controlpanel.bika_immunizations import Immunizations from controlpanel.bika_treatments import Treatments from controlpanel.bika_insurancecompanies import InsuranceCompanies from controlpanel.bika_ethnicities import Ethnicities from controlpanel.bika_vaccinationcenters import VaccinationCenters content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type) perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type, ADD_CONTENT_PERMISSION) utils.ContentInit( kind, content_types=(atype, ), permission=perm, extra_constructors=(constructor, ), fti=ftis, ).initialize(context)
def afterSetUp(self): ATSiteTestCase.afterSetUp(self) atapi.registerType(Dummy, 'Archetypes') content_types, constructors, ftis = atapi.process_types(atapi.listTypes(), PKG_NAME) portal = self.portal dummy = Dummy(oid='dummy') # put dummy in context of portal dummy = dummy.__of__(portal) portal.dummy = dummy dummy.initializeArchetype() self._dummy = dummy
def initialize(context): """ Zope2 init """ content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + " Content", content_types=content_types, permission=ADD_CONTENT_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context)
def initialize(context): import demo demo # pyflakes content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission=AddPortalContent, extra_constructors=constructors, ).initialize(context)
def afterSetUp(self): ATSiteTestCase.afterSetUp(self) registerType(Dummy, 'Archetypes') content_types, constructors, ftis = process_types(listTypes(), PKG_NAME) portal = self.portal dummy = Dummy(oid='dummy') # put dummy in context of portal dummy = dummy.__of__(portal) portal.dummy = dummy dummy.initializeArchetype() self._dummy = dummy
def initialize(context): """Initializer called when used as a Zope 2 product.""" content_types, constructors, ftis = atapi.process_types(atapi.listTypes('uwosh.admissionsPDFs'), 'uwosh.admissionsPDFs') cmfutils.ContentInit( 'uwosh.admissionsPDFs Content', content_types = content_types, permission = ADD_CONTENT_PERMISSION, extra_constructors = constructors, fti = ftis, ).initialize(context)
def initialize(context): # Example content type initialization import Products.DataGridField.examples content_types, constructors, ftis = process_types(listTypes(PKG_NAME), PKG_NAME,) ContentInit( '%s Content' % PKG_NAME, content_types = content_types, permission = AddPortalContent, extra_constructors = constructors, fti = ftis, ).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" # Fill in modules that provide content implementations: from content import fundingfolder, fundingopportunity, announcement contentTypes, constructors, ftis = atapi.process_types(atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(contentTypes, constructors): Products.CMFCore.utils.ContentInit( '%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype,), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor,) ).initialize(context)
def initialize(context): from content.aetiologicagent import AetiologicAgent from content.caseoutcome import CaseOutcome from content.casestatus import CaseStatus from content.ethnicity import Ethnicity from content.casesyndromicclassification import CaseSyndromicClassification from content.disease import Disease from content.doctor import Doctor from content.doctors import Doctors from content.drug import Drug from content.drugprohibition import DrugProhibition from content.epidemiologicalyear import EpidemiologicalYear from content.identifiertype import IdentifierType from content.immunization import Immunization from content.insurancecompany import InsuranceCompany from content.patient import Patient from content.patients import Patients from content.symptom import Symptom from content.treatment import Treatment from content.vaccinationcenter import VaccinationCenter from content.vaccinationcentercontact import VaccinationCenterContact from controlpanel.bika_aetiologicagents import AetiologicAgents from controlpanel.bika_caseoutcomes import CaseOutcomes from controlpanel.bika_casesyndromicclassifications import CaseSyndromicClassifications from controlpanel.bika_casestatuses import CaseStatuses from controlpanel.bika_diseases import Diseases from controlpanel.bika_drugprohibitions import DrugProhibitions from controlpanel.bika_drugs import Drugs from controlpanel.bika_epidemiologicalyears import EpidemiologicalYears from controlpanel.bika_identifiertypes import IdentifierTypes from controlpanel.bika_immunizations import Immunizations from controlpanel.bika_treatments import Treatments from controlpanel.bika_insurancecompanies import InsuranceCompanies from controlpanel.bika_ethnicities import Ethnicities from controlpanel.bika_vaccinationcenters import VaccinationCenters content_types, constructors, ftis = process_types( listTypes(PROJECTNAME), PROJECTNAME) allTypes = zip(content_types, constructors) for atype, constructor in allTypes: kind = "%s: Add %s" % (config.PROJECTNAME, atype.portal_type) perm = ADD_CONTENT_PERMISSIONS.get(atype.portal_type, ADD_CONTENT_PERMISSION) utils.ContentInit(kind, content_types = (atype,), permission = perm, extra_constructors = (constructor,), fti = ftis, ).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" content_types, constructors, ftis = atapi.process_types( atapi.listTypes(PROJECTNAME), PROJECTNAME) for atype, constructor in zip(content_types, constructors): utils.ContentInit( '{}: {}'.format(PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor, ), ).initialize(context)
def initialize(context): """Initializer called when used as a Zope 2 product.""" content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) utils.ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission=ADD_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context)
def afterSetUp(self): self.setRoles(['Manager']) self._dummy = mkDummyInContext(Dummy, oid='dummy', context=self.portal, schema=schema) self.article = makeContent(self.portal, 'PloneArticle', id='article') typeInfo = [ ti for ti in listTypes(PROJECTNAME) if ti['name'] == 'SimpleSmartContent' ] dummy_out = StringIO() installTypes(self.portal, dummy_out, typeInfo, PROJECTNAME)
def initialize(context): # Example content type initialization import Products.DataGridField.examples content_types, constructors, ftis = process_types( listTypes(PKG_NAME), PKG_NAME, ) ContentInit( '%s Content' % PKG_NAME, content_types=content_types, permission=AddPortalContent, extra_constructors=constructors, fti=ftis, ).initialize(context)
def initialize(context): """Inicializador chamado quando usado como um produto Zope 2.""" content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(content_types, constructors): ContentInit( '%s: %s' % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.ADD_PERMISSIONS[atype.portal_type], extra_constructors=(constructor, ), ).initialize(context)
def initialize(context): """ Zope2 init """ content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission=ADD_CONTENT_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context)
def initialize(context): """ Initialize product (called by zope2) """ #Initialize portal content content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) perma_initialize(context) cmfutils.ContentInit( PROJECTNAME + ' Content', content_types=content_types, permission=DEFAULT_ADD_CONTENT_PERMISSION, extra_constructors=constructors, fti=ftis, ).initialize(context)
def initialize(context): """ Initialize product (called by zope2) """ content.register() # Initialize portal content content_types, constructors, ftis = atapi.process_types( atapi.listTypes(PACKAGE_NAME), PACKAGE_NAME) utils.ContentInit(PACKAGE_NAME, content_types=content_types, permission=ADD_PERMISSION, extra_constructors=constructors, fti=ftis).initialize(context)
def initialize(context): from content import message, message_folder content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(content_types, constructors): cmfutils.ContentInit( "%s: %s" % (config.PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=config.SendMessage, extra_constructors=(constructor, ), ).initialize(context)
def initialize(context): from content import product, variation, price content_types, constructors, ftis = atapi.process_types( atapi.listTypes(PROJECTNAME), PROJECTNAME) for atype, constructor in zip(content_types, constructors): cmfutils.ContentInit( "%s: %s" % (PROJECTNAME, atype.portal_type), content_types=(atype, ), permission=permissions[atype.portal_type], extra_constructors=(constructor, ), ).initialize(context)