def afterSetUp(self): out = StringIO() installTypes(self.portal, out, listTypes(PROJECTNAME), PROJECTNAME) self.types = ('ArchAddOnExample', ) self.setRoles(('Manager', )) self.portal.invokeFactory('ArchAddOnExample', 'aao') self.aao = self.portal.aao
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) if PRE_PLONE3: # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. migrated = migrateFTIs(self, product=PROJECTNAME) print >>out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) # install slots slotpath='here/portlet_simpleportlet/macros/' # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() if 'Portlet' not in types: types.append('Portlet') factory.manage_setPortalFactoryTypes(listOfTypeIds = types) if 'TopicPortlet' not in types: types.append('TopicPortlet') factory.manage_setPortalFactoryTypes(listOfTypeIds = types) if 'RSSPortlet' not in types: types.append('RSSPortlet') factory.manage_setPortalFactoryTypes(listOfTypeIds = types) #create the tool instance portal = getToolByName(self, 'portal_url').getPortalObject() if not hasattr(self, 'portlet_manager'): addTool = portal.manage_addProduct['SimplePortlet'].manage_addTool addTool(type='SimplePortlet tool') at=getToolByName(self, 'portal_actions') if 'portlets' not in [action.id for action in at.listActions()]: at.addAction('portlets', 'Portlets', 'string: ${folder_url}/portlet_setup', 'python: portal.plone_utils.isDefaultPage(object) or object is folder', 'SimplePortlet: Manage Portlet Layout','object') try: if not slotpath + 'portlet_left' in portal.left_slots: portal.left_slots = list(portal.left_slots) + [slotpath+'portlet_left', ] if not slotpath + 'portlet_right' in portal.right_slots: portal.right_slots = list(portal.right_slots) + [slotpath+'portlet_right', ] except: pass # collect existing non-standard plone portlets additionalPortlets = extractExistingPortlets(self) # try to add them to the portlet_tool for p in additionalPortlets.keys(): self.portlet_manager.registerPortlet(p, additionalPortlets[p]) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self, reinstall=False): out = StringIO() utils.installDependencies(self, out) installTypes(self, out, listTypes(config.PROJECT_NAME), config.PROJECT_NAME, refresh_references=0) install_subskin(self, out, config.GLOBALS) utils.setupWorkflows(self, out) utils.setupCacheTool(self, out) utils.setupSquidTool(self, out) utils.setupPortalFactory(self, out) utils.setupFolderViews(self, out) utils.setupSiteProperties(self, out) utils.setupConfiglet(self, out) # clean up old cache policy and migrate changed schemas if reinstall: policy_utils.updateOldCachePolicy(self, out) utils.updateSchemas(self, out) # add new cache policies policy_utils.addCachePolicies(self, out) out.write("Successfully installed %s." % config.PROJECT_NAME) return out.getvalue()
def install(self): out = StringIO() # Install types type_info = listTypes(PROJECTNAME) installTypes(self, out, type_info, PROJECTNAME) # Install tools add_tool = self.manage_addProduct[PROJECTNAME].manage_addTool if not self.objectIds(spec=FSSTool.meta_type): add_tool(FSSTool.meta_type) # Install skin install_subskin(self, out, GLOBALS) # Install configlet cp_tool = getToolByName(self, 'portal_controlpanel') try: cp_tool.registerConfiglet(**fss_prefs_configlet) except: pass # Install modifier install_modifier(self, out) out.write('Installation completed.\n') return out.getvalue()
def install(self): out = StringIO() qi = getToolByName(self, 'portal_quickinstaller') installable = [ prod['id'] for prod in qi.listInstallableProducts() ] installed = [ prod['id'] for prod in qi.listInstalledProducts() ] for product in (DEPENDENCIES): if product not in installable + installed: raise RuntimeError('%s not available' % product) if product in installable: qi.installProduct(product) print >>out, 'Install %s' % product installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_cmfcpviews(self, out) site_properties = getToolByName(self, 'portal_properties').site_properties if site_properties.hasProperty('typesUseViewActionInListings'): types = list(site_properties.getProperty('typesUseViewActionInListings')) types.append('FlashMovie') site_properties.manage_changeProperties(typesUseViewActionInListings=types) print >> out, "Added FlashMovie in typesUseViewActionInListings\n" print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() self._addRole("Procurement") self._addRole("Finance") for account in config.accounts.keys(): self.acl_users.userFolderAddGroup(utils.getGroupFromAccount(account), ()) installTypes(self, out, atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) install_subskin(self, out, config.GLOBALS) wf_tool = getToolByName(self, "portal_workflow") wf_tool.setChainForPortalTypes( [t['portal_type'] for t in atapi.listTypes(config.PROJECTNAME)], "alphaflow_fake") alf = getToolByName(self, 'workflow_manager') id = "procurement" if id in alf.processes.objectIds(): IProcessWriteContainer(alf.processes).remove(id) wf_dir = os.path.abspath( os.path.join( os.path.split(config.GLOBALS['__file__'])[0], "workflows")) importer = zope.component.getUtility(IWorkflowImporter, name='xml') version = importer(file(os.path.join(wf_dir, "simple.alf"))) process = IProcessWriteContainer(alf.processes).add(id, Process(id)) process.editable(version) process.update()
def install(self): out = StringIO() install_dependencies(self, out) # ######################################## """ACV OJO 20101027 To fix error when installing product through the test machinery. """ someTypes = listTypes(PROJECTNAME) for aType in someTypes: aKlass = aType.get('klass', None) if not (aKlass == None): aFTIMetaType = getattr(aKlass, '_at_fti_meta_type', None) if not (aFTIMetaType == 'Factory-based Type Information with dynamic views'): aKlass._at_fti_meta_type = 'Factory-based Type Information with dynamic views' """ACV OJO 20101027 To fix error when installing product through the test machinery. """ # ######################################## installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_tools(self, out) print >> out, utils.installConfiglets(self, CONFIGLETS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): """ Installs the product. """ out = StringIO() # install depending products installDependencies(self, out) # install types installTypes(self, out, listTypes(PRODUCT_NAME), PRODUCT_NAME) # install subskins install_subskin(self, out, GLOBALS) # install workflows setupWorkflow(self, out) # install tools # register tool to Plone's preferences panel # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types=[ ECRB_NAME, ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) print >> out, "Successfully installed %s." % PRODUCT_NAME return out.getvalue()
def install(self): """Install STSample""" out = StringIO() print >> out, "Installing %s" % PROJECTNAME # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. migrated = migrateFTIs(self, product=PROJECTNAME) print >>out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() for add_type in ('STSample',): if add_type not in types: types.append(add_type) factory.manage_setPortalFactoryTypes(listOfTypeIds = types) print >> out, "Added %s to portal_factory" % PROJECTNAME install_resources(self, out) return out.getvalue()
def install(self): """ Quick install script This script is executed when user chooses quickinstall in Zope Management Interface or Plone Management Page @param portal Plone portal where are installing to """ portal = self # Create buffer which logs messages during installation out = StringIO() # Register Archetypes types in the portal installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) # Register layout files in the portal install_subskin(self, out, GLOBALS) # Register CSS definitions used by our product registerStylesheets(self, out, STYLESHEETS) ic = InstallationContext(self, GLOBALS) ic.requiresInstalledProduct("DataGridField") getInstallationRunner(self).install(ic, auto_reorder=1) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) #register the folderish items in portal_properties/site_properties site_props = getToolByName(self, 'portal_properties').site_properties use_folder_tabs = site_props.getProperty('use_folder_tabs', None) if not 'FaqFolder' in use_folder_tabs: site_props._updateProperty('use_folder_tabs', tuple(use_folder_tabs) + ('FaqFolder',)) print >> out, "Added FaqFolder to portal_properties/site_properties/use_folder_tabs" use_folder_contents = site_props.getProperty('use_folder_contents', None) if not 'FaqFolder' in use_folder_tabs: site_props._updateProperty('use_folder_contents', tuple(use_folder_tabs) + ('FaqFolder',)) print >> out, "Added FaqFolder to portal_properties/site_properties/use_folder_contents" print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self, reinstall=False): out = StringIO() addPloneboardTool(self, out) addCatalogIndices(self, out) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) registerNavigationTreeSettings(self, out) registerTypesWithPortalFactory(self, out) setupPloneboardWorkflow(self, out) addPortalProperties(self, out) addConfiglets(self, out) addMemberProperties(self, out) # Not sure when is best to make this call, but it works here ;-). automigrate(self, out) removeOldCatalog(self, out) migrateTransforms(self, out) addTransforms(self, out) setupRootPermissions(self, out) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self, reinstall=False): out = StringIO() out.write( 'CMFContentPanels installation tool\n') portal = getToolByName(self, 'portal_url').getPortalObject() setup_tool = getToolByName(portal, 'portal_setup') if PLONE_VERSION >= 3: setup_tool.runAllImportStepsFromProfile( "profile-Products.CMFContentPanels:default", purge_old=False) else: factory_tool = getToolByName(self,'portal_factory') factory_types=[ "ContentPanels", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) if not hasattr(portal, 'portal_contentpanels'): portal._setObject( 'portal_contentpanels', ContentPanelsTool() ) out.write('Added ConentPanels Tool\n') p_cp=getToolByName(self, 'portal_contentpanels') p_cp.manage_installAllViewlets() install_RSSCache(portal, out) install_default_page(portal, out) addViewMethods(portal, out) return out.getvalue()
def install(self): out = StringIO() if INSTALL_DEMO_TYPES: installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) setupProperties(self, out) configureFormController(self, out) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def afterSetUp(self): out=StringIO() installTypes(self.portal, out, listTypes(PROJECTNAME), PROJECTNAME) self.types = ('ArchAddOnExample',) self.setRoles(('Manager',)) self.portal.invokeFactory('ArchAddOnExample', 'aao') self.aao = self.portal.aao
def install(self): out = StringIO() # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Set up the workflow for the widget types setupFileAttachmentWorkflow(self) setupImageAttachmentWorkflow(self) print >> out, "Set up FileAttachment and ImageAttachment workflows." # Make the widget types use the /view action when linked to setupFileAttachmentView(self) setupImageAttachmentView(self) print >> out, "Set up FileAttachment and ImageAttachment to use /view." propsTool = getToolByName(self, 'portal_properties') siteProperties = getattr(propsTool, 'site_properties') navtreeProperties = getattr(propsTool, 'navtree_properties') # Add the FileAttachment and ImageAttachment types to types_not_searched # (this is configurable via the Search settings control panel) typesNotSearched = list(siteProperties.getProperty('types_not_searched')) if 'FileAttachment' not in typesNotSearched: typesNotSearched.append('FileAttachment') if 'ImageAttachment' not in typesNotSearched: typesNotSearched.append('ImageAttachment') siteProperties.manage_changeProperties(types_not_searched = typesNotSearched) print >> out, "Added FileAttachment and ImageAttachment to types_not_searched" # Add FileAttachment and ImageAttachment to kupu's linkable and media types kupuTool = getToolByName(self, 'kupu_library_tool') linkable = list(kupuTool.getPortalTypesForResourceType('linkable')) mediaobject = list(kupuTool.getPortalTypesForResourceType('mediaobject')) if 'FileAttachment' not in linkable: linkable.append('FileAttachment') if 'ImageAttachment' not in linkable: linkable.append('ImageAttachment') if 'ImageAttachment' not in mediaobject: mediaobject.append('ImageAttachment') # kupu_library_tool has an idiotic interface, basically written purely to # work with its configuration page. :-( kupuTool.updateResourceTypes(({'resource_type' : 'linkable', 'old_type' : 'linkable', 'portal_types' : linkable}, {'resource_type' : 'mediaobject', 'old_type' : 'mediaobject', 'portal_types' : mediaobject},)) print >> out, "Added FileAttachment and ImageAttachment to kupu's linkable and mediaobject types" return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def install(self): out = StringIO() installTypes(self, out, listTypes(PKG_NAME), PKG_NAME) install_subskin(self, out, GLOBALS) setupActions(self) print >> out, "Successfully installed %s." % PKG_NAME return out.getvalue()
def setupDemoTypes(context): """ install demo types if required by config """ classes = listTypes(PROJECTNAME) if INSTALL_DEMO_TYPES: installTypes(context, out, classes, PROJECTNAME) LOG.info("Demo types successfully installed for %s." % PROJECTNAME)
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 install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): """Install COREBlog2: Install content types, skin layer, install the stylesheet, set up global properties, enable the portal factory and set up form controller actions for the widget actions """ out = StringIO() # Install tool id = COREBlog2Tool.id if not hasattr(aq_base(self), id): addTool = self.manage_addProduct['COREBlog2'].manage_addTool addTool(COREBlog2Tool.meta_type) print >>out, 'Installing COREBlog2 Tool' print >> out, "Installing COREBlog2" # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. try: migrated = migrateFTIs(self, product=PROJECTNAME) print >>out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) except: print >>out, "DynamicViewFTI might not works well. You use Plone 3.0 alpha ?" # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() for add_type in ['COREBlog2','COREBlogEntry','COREBlogCategory']: if add_type not in types: types.append(add_type) factory.manage_setPortalFactoryTypes(listOfTypeIds = types) print >> out, "Added COREBlog2 to portal_factory" #propsTool = getToolByName(self, 'portal_properties') #siteProperties = getattr(propsTool, 'site_properties') #navtreeProperties = getattr(propsTool, 'navtree_properties') # install enabled index for topic atcttool = getToolByName(self, 'portal_atct') atcttool.addIndex('getTags', 'Tag', 'Tag(Category)', True, ('ATListCriterion', )) return out.getvalue()
def install(self): out = StringIO() classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) print >> out, 'Successfully installed %s' % PROJECTNAME return out.getvalue()
def install(self): out = StringIO() if INSTALL_SAMPLE_TYPES: installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def installTypes(self): types = listTypes(self._productname) self.msg("Installing types") # helper message if not types: self.info("No Types found! Have you forgot to register some AT Class? (registerType(-classname-))") exit installTypes(self.getContext(), self.getStream(), types, self._productname)
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) print >> out, 'Types Installed' install_subskin(self, out, GLOBALS) print >> out, 'Skins Installed' out.write('Installation %s successfully completed.\n' % PROJECTNAME) return out.getvalue()
def old_install(self): out = StringIO() install_dependencies(self, out) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_tools(self, out) print >> out, utils.installConfiglets(self, CONFIGLETS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): out=StringIO(); installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) install_tool(self, out) install_configlet(self, out) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def install(self): """Install COREBlog2: Install content types, skin layer, install the stylesheet, set up global properties, enable the portal factory and set up form controller actions for the widget actions """ out = StringIO() # Install tool id = COREBlog2Tool.id if not hasattr(aq_base(self), id): addTool = self.manage_addProduct['COREBlog2'].manage_addTool addTool(COREBlog2Tool.meta_type) print >> out, 'Installing COREBlog2 Tool' print >> out, "Installing COREBlog2" # Install types classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Installed types" # Install skin install_subskin(self, out, GLOBALS) print >> out, "Installed skin" # Migrate FTI, to make sure we get the necessary infrastructure for the # 'display' menu to work. try: migrated = migrateFTIs(self, product=PROJECTNAME) print >> out, "Switched to DynamicViewFTI: %s" % ', '.join(migrated) except: print >> out, "DynamicViewFTI might not works well. You use Plone 3.0 alpha ?" # Enable portal_factory factory = getToolByName(self, 'portal_factory') types = factory.getFactoryTypes().keys() for add_type in ['COREBlog2', 'COREBlogEntry', 'COREBlogCategory']: if add_type not in types: types.append(add_type) factory.manage_setPortalFactoryTypes(listOfTypeIds=types) print >> out, "Added COREBlog2 to portal_factory" #propsTool = getToolByName(self, 'portal_properties') #siteProperties = getattr(propsTool, 'site_properties') #navtreeProperties = getattr(propsTool, 'navtree_properties') # install enabled index for topic atcttool = getToolByName(self, 'portal_atct') atcttool.addIndex('getTags', 'Tag', 'Tag(Category)', True, ('ATListCriterion', )) return out.getvalue()
def install(self): out=StringIO(); installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) setPortalFactoryType(self, out) install_workflow(self, out) # install_subskin(self, out, GLOBALS) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue()
def configureTypes(self, out): """Register new types and configure them.""" installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) ft=getToolByName(self, "portal_factory") pft=ft.getFactoryTypes().keys() for type in [ "FAQ", "FAQEntry" ]: if type not in pft: print >>out, "Adding %s to factory types" % type pft.append(type) ft.manage_setPortalFactoryTypes(listOfTypeIds=pft)
def configureTypes(self, out): """Register new types and configure them.""" installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) ft=getToolByName(self, "portal_factory") pft=list(ft.getFactoryTypes().keys()) for type in [ "FAQ", "FAQEntry" ]: if type not in pft: print("Adding %s to factory types" % type, file=out) pft.append(type) ft.manage_setPortalFactoryTypes(listOfTypeIds=pft)
def install(self): out = StringIO() sys.modules['Products.PlonePopoll.PlonePopoll'] = sys.modules['Products.PlonePopoll.content.PlonePopoll'] # install types typeInfo = listTypes(PROJECTNAME) installTypes(self, out, typeInfo, PROJECTNAME) # install skin install_subskin(self, out, GLOBALS) # Install portlet setupCustomSlots(self, out) # Add portal types to use portal factory pftool = getToolByName(self, 'portal_factory') pftool.manage_setPortalFactoryTypes(listOfTypeIds = (PROJECTNAME,)) # Install tool setupTools(self, out) install_configlet(self, out) provider = getToolByName(self, 'portal_selenium', None) if provider: # Functional Tests action = {'id':PROJECTNAME.lower(), 'name':PROJECTNAME, 'action':'string:here/get_%s_ftests'%PROJECTNAME.lower(), 'condition': '', 'permission': 'View', 'category':'ftests', 'visible': 1} provider.addAction(**action) typesTool = getToolByName(self, 'portal_types') # Set the human readable title explicitly t = getattr(typesTool, 'PlonePopoll', None) if t: t.title = 'Poll' # Hide Polls from the navtree ntp = getToolByName(self, 'portal_properties').navtree_properties bl = list(ntp.getProperty('metaTypesNotToList', ())) if 'PlonePopoll' not in bl: bl.append('PlonePopoll') ntp._p_changed = 1 ntp.metaTypesNotToList = bl #raise "Installation OK" out.write('Installation completed.\n') return out.getvalue()
def install(self): out = StringIO() out.write('setupSkin... \n') setupSkin(self, out, PROJECTNAME) installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) print >> out, 'Type Installed' setupActions(self, out) return out.getvalue()
def installContentTypes(self, out): """ Install new portal types and add to the portal_factory """ typesInfo = listTypes(PROJECTNAME) installTypes(self, out, typesInfo, PROJECTNAME) out.write("Installed types\n") factory_tool = getToolByName(self, 'portal_factory') types = factory_tool.getFactoryTypes().keys() for item in NEW_PORTAL_TYPES: if item not in types: types.append(item) factory_tool.manage_setPortalFactoryTypes(listOfTypeIds = types) out.write('Added %s portal type to portal_factory\n' % item)
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 install(self): portal=getToolByName(self,'portal_url').getPortalObject() out = StringIO() classes=listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Successfully installed %s." % PROJECTNAME sr = PloneSkinRegistrar('skins', product_globals) print >> out,sr.install(self) print >> out,sr.install(self,position='custom',mode='after',layerName=PROJECTNAME+'_public') return out.getvalue()
def install(self): portal = getToolByName(self, 'portal_url').getPortalObject() out = StringIO() classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) print >> out, "Successfully installed %s." % PROJECTNAME sr = PloneSkinRegistrar('skins', product_globals) print >> out, sr.install(self) #sr = PloneSkinRegistrar('skins', product_globals) print >> out, sr.install(self, position='custom', mode='after', layerName=PROJECTNAME + '_public') #register folderish classes in use_folder_contents props = getToolByName(self, 'portal_properties').site_properties use_folder_tabs = list(props.use_folder_tabs) print >> out, 'adding classes to 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 []: use_folder_tabs.append(cl['klass'].portal_type) props.use_folder_tabs = tuple(use_folder_tabs) #autoinstall tools for t in []: try: portal.manage_addProduct[PROJECTNAME].manage_addTool(t) # tools are not content. dont list it in navtree except: #heuristics for testing if an instance with the same name already exists #only this error will be swallowed. #Zope raises in an unelegant manner a 'Bad Request' error e = sys.exc_info() if e[0] != 'Bad Request': raise #hide tools in the navigation for t in []: try: if t not in self.portal_properties.navtree_properties.metaTypesNotToList: self.portal_properties.navtree_properties.metaTypesNotToList= \ list(self.portal_properties.navtree_properties.metaTypesNotToList) + \ [t] except TypeError, e: print 'Attention: could not set the navtree properties:', e
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) # currentIds = self.objectIds() # for i in currentIds: # if i == "MapServer": # self.manage_delObjects(["MapServer"]) # # #self.invokeFactory(id="MapServer", type_name="MapServer") # self._setObject("MapServer",MapServerFacade("MapServer")) return out.getvalue()
def install(self): out = StringIO() portal = getToolByName(self, 'portal_url').getPortalObject() classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) setup_tool = getToolByName(self, 'portal_setup') setup_tool.setImportContext('profile-FinanceFields:default') result = setup_tool.runImportStep('propertiestool') out.write('Steps run: %s \n' % ', '.join(result['steps'])) out.write("Successfully installed %s." % PROJECTNAME) return out.getvalue()
def configureTypes(self, out): """Register new types and configure them. """ # install types installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) print >> out, "installed types." # enable portal_factory to create temporary content factory = getToolByName(self, "portal_factory") types = factory.getFactoryTypes().keys() for t in [ "LandingPage", "TextBlock" ]: if t not in types: print >> out, "Adding %s to factory types" % t types.append(t) factory.manage_setPortalFactoryTypes(listOfTypeIds = types)
def install(self): out = StringIO() print >> out, 'Installing skin ...' install_subskin(self, out, config.GLOBALS) print >> out, 'Installing types ...' installTypes(self, out, listTypes(config.PROJECTNAME), config.PROJECTNAME) print >> out, "Setting catalog types ..." configure_catalogs(self, out) install_roles(self, out, ['Assignee', 'ProcessUser']) print >> out, 'Importing faked workflow' install_dcworkflow(self, out) print >> out, "Installing 'workflow_manager' ..." install_manager(self, out) print >> out, "Setting initial permissions ..." configure_permissions(self, out) print >> out, "Registering Instance object ..." install_instanceobject(self, out) print >> out, "Registering work items" install_workitems(self, out) print >> out, "Configuring portal catalog index / event channel" install_portal_catalog(self, out) print >> out, "Adding portlet ..." portlet = "here/portlet_worklist/macros/portlet" if portlet not in self.right_slots: self.right_slots = tuple(self.right_slots) + (portlet, ) print >> out, 'Upgrading instances ...' upgrade_instances(self, out) if config.PATCH_PLONE_TYPES: print >> out, "Installing process definitions ..." install_process_definitions(self, out, config.GLOBALS) print >> out, "Successfully installed AlphaFlow" return out.getvalue()
def DEPRECATED_install(self): out = StringIO() # Install types typeInfo = listTypes(PROJECTNAME) installTypes(self, out, typeInfo, PROJECTNAME) # Install tools add_tool = self.manage_addProduct[PROJECTNAME].manage_addTool if not self.objectIds(spec=BookingTool.meta_type): add_tool(BookingTool.meta_type) # Install skin install_subskin(self, out, GLOBALS) # Install permissions self.manage_permission(BookingPermissions.AddBooking, ('Member', 'Owner', 'Manager'), 1) # Add portal types to use portal factory pftool = getToolByName(self, 'portal_factory') pftool.manage_setPortalFactoryTypes(listOfTypeIds=('Booking', 'BookableObject')) # Install workflows #addWorkflow(self, out) # Add action icons addActionIcon(self, category='plone', action_id='book', icon_expr='booking.gif', title="Book an object", priority=0) # Hide Booking from the navtree ntp = getToolByName(self, 'portal_properties').navtree_properties bl = list(ntp.getProperty('metaTypesNotToList', ())) if 'Booking' not in bl: bl.append('Booking') ntp._p_changed = 1 ntp.metaTypesNotToList = bl out.write('Installation completed.\n') return out.getvalue()
def install(self, reinstall=False): """ External Method to install BungeniHelpCenter """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME portal = getToolByName(self, 'portal_url').getPortalObject() # If the config contains a list of dependencies, try to install them from Products.BungeniHelpCenter.config import DEPENDENCIES quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) import transaction transaction.savepoint(optimistic=True) types = getToolByName(self, 'portal_types') tutorial_folder = types['HelpCenterTutorialFolder'] tutorial_folder.allowed_content_types = ('BungeniHelpCenterTutorial', ) tutorial_folder = types['HelpCenterReferenceManualFolder'] tutorial_folder.allowed_content_types = ( 'BungeniHelpCenterReferenceManual', ) tutorial_folder.allowed_content_types = ('BungeniHelpCenterGlossary', ) reference_section = types['HelpCenterReferenceManualSection'] reference_section.allowed_content_types = ('BungeniHelpCenterReferenceManualPage', 'Image',\ 'BungeniHelpCenterReferenceManualSection') classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # autoinstall tools portal = getToolByName(self, 'portal_url').getPortalObject() setup_tool = getToolByName(portal, 'portal_setup') setup_tool.runAllImportStepsFromProfile( 'profile-Products.BungeniHelpCenter:default') print >> out, 'Installed' return out.getvalue()
def install(self, reinstall=False): """ External Method to install <dtml-var "package.getProductModuleName()"> """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.<dtml-var "package.getProductModuleName()">.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self,'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS)
def install(self, reinstall=False): """ External Method to install Bungeni """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.Bungeni.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) import transaction transaction.savepoint(optimistic=True) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # autoinstall tools portal = getToolByName(self, 'portal_url').getPortalObject() for t in ['BungeniMembershipTool', 'RotaTool']: try: portal.manage_addProduct[PROJECTNAME].manage_addTool(t) except BadRequest: # if an instance with the same name already exists this error will # be swallowed. Zope raises in an unelegant manner a 'Bad Request' error pass except: e = sys.exc_info() if e[0] != 'Bad Request': raise # hide tools in the search form portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: siteProperties = getattr(portalProperties, 'site_properties', None) if siteProperties is not None and siteProperties.hasProperty( 'types_not_searched'): for tool in ['BungeniMembershipTool', 'RotaTool']: current = list( siteProperties.getProperty('types_not_searched')) if tool not in current: current.append(tool) siteProperties.manage_changeProperties( **{'types_not_searched': current}) # remove workflow for tools portal_workflow = getToolByName(self, 'portal_workflow') for tool in ['BungeniMembershipTool', 'RotaTool']: portal_workflow.setChainForPortalTypes([tool], '') # uncatalog tools for toolname in ['portal_bungenimembershiptool', 'portal_rotatool']: try: portal[toolname].unindexObject() except: pass # hide tools in the navigation portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: navtreeProperties = getattr(portalProperties, 'navtree_properties', None) if navtreeProperties is not None and navtreeProperties.hasProperty( 'idsNotToList'): for toolname in [ 'portal_bungenimembershiptool', 'portal_rotatool' ]: current = list(navtreeProperties.getProperty('idsNotToList')) if toolname not in current: current.append(toolname) navtreeProperties.manage_changeProperties( **{'idsNotToList': current}) # register tools as configlets portal_controlpanel = getToolByName(self, 'portal_controlpanel') portal_controlpanel.unregisterConfiglet('RotaTool') portal_controlpanel.registerConfiglet( 'RotaTool', #id of your Tool 'RotaTool', # Title of your Product 'string:${portal_url}/portal_rotatool/view', 'python:True', # a condition 'Manage portal', # access permission 'Products', # section to which the configlet should be added: (Plone, Products (default) or Member) 1, # visibility 'RotaToolID', 'site_icon.gif', # icon in control_panel 'Defaults for rota generation', None, ) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # Adds our types to MemberDataContainer.allowed_content_types types_tool = getToolByName(self, 'portal_types') act = types_tool.MemberDataContainer.allowed_content_types types_tool.MemberDataContainer.manage_changeProperties( allowed_content_types=act + ( 'MemberOfPublic', 'MemberOfParliament', 'Staff', )) # registers with membrane tool ... membrane_tool = getToolByName(self, 'membrane_tool') membrane_tool.registerMembraneType('MemberOfPublic') # print >> out, SetupMember(self, member_type='MemberOfPublic', register=False).finish() membrane_tool.registerMembraneType('MemberOfParliament') # print >> out, SetupMember(self, member_type='MemberOfParliament', register=False).finish() membrane_tool.registerMembraneType('Staff') # print >> out, SetupMember(self, member_type='Staff', register=False).finish() #bind classes to workflows wft = getToolByName(self, 'portal_workflow') wft.setChainForPortalTypes(['Staff'], "MemberAutoWorkflow") wft.setChainForPortalTypes(['Motion'], "ParliamentaryEventWorkflow") wft.setChainForPortalTypes(['Question'], "ParliamentaryEventWorkflow") wft.setChainForPortalTypes(['LegislationFolder'], "BungeniWorkflow") wft.setChainForPortalTypes(['BillPage'], "SubWorkflow") wft.setChainForPortalTypes(['DebateRecordPage'], "SubWorkflow") wft.setChainForPortalTypes(['DebateRecordSection'], "SubWorkflow") # configuration for Relations relations_tool = getToolByName(self, 'relations_library') xmlpath = os.path.join(package_home(GLOBALS), 'relations.xml') f = open(xmlpath) xml = f.read() f.close() relations_tool.importXML(xml) # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "MemberOfPublic", "MemberOfParliament", "BungeniMembershipTool", "Staff", "LongDocument", "LongDocumentSection", "LongDocumentPage", "HelpFolder", "MinistryFolder", "Motion", "Question", "Response", "OrderOfBusiness", "AgendaItem", "Sitting", "Session", "CommitteeFolder", "LegislationFolder", "Bill", "BillPage", "BillSection", "Amendment", "DebateRecord", "DebateRecordPage", "DebateRecordFolder", "DebateRecordSection", "TakeTranscription", "Minutes", "Take", "RotaFolder", "RotaItem", "RotaTool", "Committee", "PoliticalGroup", "Reporters", "Parliament", "Office", "BungeniTeamSpace", "DebateRecordOffice", "BungeniTeam", "Region", "Constituency", "Regions", "Province", "OfficeWS", "OfficeFolder", "ParliamentWS", "CommitteeWS", "Ministry", "Portfolio", "Government", "Minister", "AssistantMinister", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.Bungeni.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.Bungeni.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' setup_tool = getToolByName(portal, 'portal_setup') setup_tool.setImportContext('profile-Bungeni:default') setup_tool.runAllImportSteps() setup_tool.setImportContext('profile-CMFPlone:plone') print >> out, "Ran all GS import steps." return out.getvalue()
def install(self, reinstall=False): """ External Method to install UWOshCommitteeOnCommittees """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.UWOshCommitteeOnCommittees.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "Committee", "CommitteeMember", "College", "Division", "Department", "Constituency", "Person", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.UWOshCommitteeOnCommittees.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.UWOshCommitteeOnCommittees.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def install_types(self, out): types, project = listTypes(PROJECTNAME), PROJECTNAME installTypes(self, out, types, project)
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECT_NAME), PROJECT_NAME) install_subskin(self, out, GLOBALS) out.write("Successfully installed %s." % PROJECT_NAME) return out.getvalue()
def install(self, reinstall=False): """ External Method to install gvSIGbpd """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.gvSIGbpd.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # configuration for Relations relations_tool = getToolByName(self, 'relations_library') xmlpath = os.path.join(package_home(GLOBALS), 'relations.xml') f = open(xmlpath) xml = f.read() f.close() # ########################### """ACV 20091124 Avoid lots of log entries from catalogs complaining about not found entries for instances affected by the importXML Was: relations_tool.importXML(xml) """ try: aDisableLevel = logging.getLogger('Zope.ZCatalog').manager.disable logging.getLogger( 'Zope.ZCatalog').manager.disable = cLoggingLevel_ERROR relations_tool.importXML(xml) finally: logging.getLogger('Zope.ZCatalog').manager.disable = aDisableLevel """ACV 20091124 """ # ########################### # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "BPDColeccionPoliticasDeNegocio", "BPDPlazo", "BPDSalida", "BPDPoliticaDeNegocio", "BPDFracasoFinal", "BPDEnvio", "BPDEscenario", "BPDExitoFinal", "BPDColeccionHerramientas", "BPDColeccionPasos", "BPDUnidadOrganizacional", "BPDColeccionProcesosDeNegocio", "BPDProcesoDeNegocioSimple", "BPDRecepcion", "BPDListaDePruebas", "BPDCasoDePrueba", "BPDPreCondicion", "BPDPrograma", "BPDPuntoExtension", "BPDColeccionCasosDePrueba", "BPDEntrada", "BPDColeccionSalidas", "BPDHerramienta", "BPDColeccionPerfiles", "BPDDecision", "BPDPasoSimple", "BPDCaracteristica", "BPDResolucionDatos", "BPDSubProceso", "BPDUsoArtefacto", "BPDExtensionProceso", "BPDPerfil", "BPDCondicion", "BPDReglaDeNegocio", "BPDArtefacto", "BPDPostCondicion", "BPDUsoCaracteristica", "BPDColeccionReglasDeNegocio", "BPDReferenciaCualificada", "BPDPasoGestorExcepciones", "BPDColeccionListasDePruebas", "BPDColeccionArtefactos", "BPDColeccionEntradas", "BPDDatosDePrueba", "BPDColeccionUnidadesOrganizacionales", "BPDOrganizacion", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.gvSIGbpd.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.gvSIGbpd.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def install(portal): out = StringIO() installwickedat(portal) installTypes(portal, out, listTypes(zope2.PROJECTNAME), zope2.PROJECTNAME)
def install(self, reinstall=False): """ External Method to install Marginalia """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.Marginalia.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) import transaction transaction.savepoint(optimistic=True) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # autoinstall tools portal = getToolByName(self, 'portal_url').getPortalObject() for t in ['Annotations']: try: portal.manage_addProduct[PROJECTNAME].manage_addTool(t) except BadRequest: # if an instance with the same name already exists this error will # be swallowed. Zope raises in an unelegant manner a 'Bad Request' error pass except: e = sys.exc_info() if e[0] != 'Bad Request': raise # Adding a new catalog index catalog = getToolByName(portal, "portal_catalog") if 'getAccess' not in catalog.indexes(): catalog.addIndex('getAccess', 'FieldIndex') catalog.addIndex('getEditType', 'FieldIndex') # hide tools in the search form portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: siteProperties = getattr(portalProperties, 'site_properties', None) if siteProperties is not None and siteProperties.hasProperty( 'types_not_searched'): for tool in ['Annotations']: current = list( siteProperties.getProperty('types_not_searched')) if tool not in current: current.append(tool) siteProperties.manage_changeProperties( **{'types_not_searched': current}) # remove workflow for tools portal_workflow = getToolByName(self, 'portal_workflow') portal_workflow.setChainForPortalTypes(['Annotations'], '') portal_workflow.setChainForPortalTypes(['Annotation'], 'annotation_workflow') # uncatalog tools for toolname in ['portal_annotations']: try: portal[toolname].unindexObject() except: pass # hide tools in the navigation portalProperties = getToolByName(self, 'portal_properties', None) if portalProperties is not None: navtreeProperties = getattr(portalProperties, 'navtree_properties', None) if navtreeProperties is not None and navtreeProperties.hasProperty( 'idsNotToList'): for toolname in ['portal_annotations']: current = list(navtreeProperties.getProperty('idsNotToList')) if toolname not in current: current.append(toolname) navtreeProperties.manage_changeProperties( **{'idsNotToList': current}) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "Annotation", "AnnotatableDocument", "Annotations", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) portal.portal_annotations.manage_permission("Add portal content", ["Member", "Anonymous"], 1) from Products.Marginalia.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.Marginalia.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def install(self, reinstall=False): """ External Method to install BungeniSkinTZ """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.BungeniSkinTZ.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) portal = getToolByName(self, 'portal_url').getPortalObject() for slot in ['here/theme_portlet/macros/portlet']: if slot not in portal.left_slots: portal.left_slots = list(portal.left_slots) + [slot] for slot in ['here/sections_portlet/macros/portlet']: if slot not in portal.right_slots: portal.right_slots = list(portal.right_slots) + [slot] # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' from Products.BungeniSkinTZ.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.BungeniSkinTZ.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def install(self, reinstall=False): """ External Method to install gvSIGi18n """ out = StringIO() print >> out, "Installation log of %s:" % PROJECTNAME # If the config contains a list of dependencies, try to install # them. Add a list called DEPENDENCIES to your custom # AppConfig.py (imported by config.py) to use it. try: from Products.gvSIGi18n.config import DEPENDENCIES except: DEPENDENCIES = [] portal = getToolByName(self, 'portal_url').getPortalObject() quickinstaller = portal.portal_quickinstaller for dependency in DEPENDENCIES: print >> out, "Installing dependency %s:" % dependency quickinstaller.installProduct(dependency) get_transaction().commit(1) classes = listTypes(PROJECTNAME) installTypes(self, out, classes, PROJECTNAME) install_subskin(self, out, GLOBALS) # try to call a workflow install method # in 'InstallWorkflows.py' method 'installWorkflows' try: installWorkflows = ExternalMethod('temp', 'temp', PROJECTNAME + '.InstallWorkflows', 'installWorkflows').__of__(self) except NotFound: installWorkflows = None if installWorkflows: print >> out, 'Workflow Install:' res = installWorkflows(self, out) print >> out, res or 'no output' else: print >> out, 'no workflow install' # enable portal_factory for given types factory_tool = getToolByName(self, 'portal_factory') factory_types = [ "TRAColeccionInformes", "TRAModulo", "TRAColeccionCadenas", "TRAProgreso", "TRAInforme", "TRAParametrosControlProgreso", "TRAContenidoXML", "TRAColeccionImportaciones", "TRACadena", "TRAColeccionSolicitudesCadenas", "TRAConfiguracionSolicitudesCadenas", "TRAConfiguracionPaginaTraducciones", "TRASimbolosOrdenados", "TRACatalogo", "TRAColeccionIdiomas", "TRAConfiguracionInvalidacionInformes", "TRAConfiguracionVarios", "TRAContenidoIntercambio", "TRAConfiguracionImportacion", "TRAConfiguracionExportacion", "TRAImportacion", "TRAIdioma", "TRAColeccionModulos", "TRATraduccion", "TRAColeccionContribuciones", "TRAColeccionProgresos", "TRAConfiguracionPermisos", "TRAContribuciones", "TRAConfiguracionPerfilEjecucion", "TRASolicitudCadena", ] + factory_tool.getFactoryTypes().keys() factory_tool.manage_setPortalFactoryTypes(listOfTypeIds=factory_types) from Products.gvSIGi18n.config import STYLESHEETS try: portal_css = getToolByName(portal, 'portal_css') for stylesheet in STYLESHEETS: try: portal_css.unregisterResource(stylesheet['id']) except: pass defaults = {'id': '', 'media': 'all', 'enabled': True} defaults.update(stylesheet) portal_css.registerStylesheet(**defaults) except: # No portal_css registry pass from Products.gvSIGi18n.config import JAVASCRIPTS try: portal_javascripts = getToolByName(portal, 'portal_javascripts') for javascript in JAVASCRIPTS: try: portal_javascripts.unregisterResource(javascript['id']) except: pass defaults = {'id': ''} defaults.update(javascript) portal_javascripts.registerScript(**defaults) except: # No portal_javascripts registry pass # try to call a custom install method # in 'AppInstall.py' method 'install' try: install = ExternalMethod('temp', 'temp', PROJECTNAME + '.AppInstall', 'install') except NotFound: install = None if install: print >> out, 'Custom Install:' try: res = install(self, reinstall) except TypeError: res = install(self) if res: print >> out, res else: print >> out, 'no output' else: print >> out, 'no custom install' return out.getvalue()
def DEPRECATED_install(self): out = StringIO() sys.modules['Products.PlonePopoll.PlonePopoll'] = sys.modules['Products.PlonePopoll.content.PlonePopoll'] # install types typeInfo = listTypes(PROJECTNAME) installTypes(self, out, typeInfo, PROJECTNAME) # install skin install_subskin(self, out, GLOBALS) # Install portlet setupCustomSlots(self, out) # Add portal types to use portal factory portal_factory = getToolByName(self, 'portal_factory') if portal_factory is not None: factoryTypes = list(portal_factory.getFactoryTypes().keys()) factoryTypes.append('PlonePopoll') portal_factory.manage_setPortalFactoryTypes(listOfTypeIds = factoryTypes) else: out.write('Couldn\'t get Portal Factory, so couldn\'t add PlonePopoll type to it\n') # Install tool setupTools(self, out) install_configlet(self, out) provider = getToolByName(self, 'portal_selenium', None) if provider: # Functional Tests action = {'id':PROJECTNAME.lower(), 'name':PROJECTNAME, 'action':'string:here/get_%s_ftests'%PROJECTNAME.lower(), 'condition': '', 'permission': 'View', 'category':'ftests', 'visible': 1} provider.addAction(**action) typesTool = getToolByName(self, 'portal_types') # Set the human readable title explicitly t = getattr(typesTool, 'PlonePopoll', None) if t: t.title = 'Poll' # Hide Polls from the navtree ntp = getToolByName(self, 'portal_properties').navtree_properties bl = list(ntp.getProperty('metaTypesNotToList', ())) if 'PlonePopoll' not in bl: bl.append('PlonePopoll') ntp._p_changed = 1 ntp.metaTypesNotToList = bl migratePopollConfiguration(self, out) #raise "Installation OK" out.write('Installation completed.\n') return out.getvalue()