Пример #1
0
def install(self,reinstall=False):
    
    
    """Install a set of products (which themselves may either use Install.py
    or GenericSetup extension profiles for their configuration) and then
    install a set of extension profiles.
    
    One of the extension profiles we install is that of this product. This
    works because an Install.py installation script (such as this one) takes
    precedence over extension profiles for the same product in 
    portal_quickinstaller. 
    
    We do this because it is not possible to install other products during
    the execution of an extension profile (i.e. we cannot do this during
    the importVarious step for this profile).
    """
    
    portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
    portal_setup = getToolByName(self, 'portal_setup')
    from Products.GenericSetup.context import Logger,SetupEnviron
    import logging
    obj = SetupEnviron()
    out = StringIO()
    logger = obj.getLogger("cenditel.ppm")
    outch = logging.StreamHandler(out)
    logger.addHandler(outch)
    #import pdb; pdb.set_trace()
    if reinstall:
        for product in PRODUCT_DEPENDENCIES:
            
            if not portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()
        for product in PRODUCT_DEPENDENCIES:
            #import pdb; pdb.set_trace()
            if portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.reinstallProducts([product])
                transaction.savepoint()
            elif not portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()
    else:
        for product in PRODUCT_DEPENDENCIES:
            if not portal_quickinstaller.isProductInstalled(product):
               logger.info("Installing missing product: %s" % product)
               portal_quickinstaller.installProduct(product)
               transaction.savepoint()
               
    for extension_id in EXTENSION_PROFILES:
        portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False)
        product_name = extension_id.split(':')[0]
        portal_quickinstaller.notifyInstalled(product_name)
        transaction.savepoint()
Пример #2
0
def importVarious(context):
    """Miscellanous steps import handle
    """
    #VAMOS A PONERLA EN EL CONFIG
    USERNAME='******'
    username=USERNAME
    title='cenditel.ppm'
    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a 
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('cenditel.ppm.txt') is None:
        return

    portal = context.getSite()
    obj = SetupEnviron()   
    logger = obj.getLogger("cenditel.ppm")
    MakeDefaultUser(context, username, title)
Пример #3
0
def install(self, reinstall=False):
    """Install a set of products (which themselves may either use Install.py
    or GenericSetup extension profiles for their configuration) and then
    install a set of extension profiles.
    
    One of the extension profiles we install is that of this product. This
    works because an Install.py installation script (such as this one) takes
    precedence over extension profiles for the same product in 
    portal_quickinstaller. 
    
    We do this because it is not possible to install other products during
    the execution of an extension profile (i.e. we cannot do this during
    the importVarious step for this profile).
    """
    out = StringIO()
    from Products.GenericSetup.context import Logger, SetupEnviron
    import logging
    obj = SetupEnviron()
    logger = obj.getLogger("ubify.policy")
    outch = logging.StreamHandler(out)
    logger.addHandler(outch)

    #import pdb; pdb.set_trace()

    portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
    portal_setup = getToolByName(self, 'portal_setup')

    if reinstall:
        for product in PRODUCT_DEPENDENCIES:
            if not portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()
        for product in PRODUCT_DEPENDENCIES:
            if portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.reinstallProducts([product])
                transaction.savepoint()
            elif not portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()
    else:
        for product in PRODUCT_DEPENDENCIES:
            if not portal_quickinstaller.isProductInstalled(product):
                logger.info("Installing missing product: %s" % product)
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()

    for extension_id in EXTENSION_PROFILES:
        portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id,
                                                  purge_old=False)
        product_name = extension_id.split(':')[0]
        portal_quickinstaller.notifyInstalled(product_name)
        transaction.savepoint()

    #call one time installation here if reinstall is false
    portal = self

    if reinstall:

        for product in UNINSTALL_PRODUCTS:
            if portal_quickinstaller.isProductInstalled(product):
                try:
                    from Products.CMFQuickInstallerTool.InstalledProduct import InstalledProduct

                    prod = getattr(portal_quickinstaller, product)
                    prod.uninstall(cascade=InstalledProduct.default_cascade,
                                   reinstall=False)
                    logger.info("Uninstalled product successfully : %s" %
                                (product, ))
                except AttributeError:
                    pass
                transaction.savepoint()

        from ubify.policy.migration.onetimeinstall import disableGlobalAdds, reorder_contenttyperegistry
        reorder_contenttyperegistry(portal, logger)
        disableGlobalAdds(portal, logger)
    else:
        from ubify.policy.migration.onetimeinstall import assignStackerRelatedPortlet, setup_sitehome_portlets
        from ubify.policy.migration.onetimeinstall import disableGlobalAdds, disable_inlineEditing
        from ubify.policy.setuphandlers import addDefaultCategories
        from ubify.policy.migration.onetimeinstall import remove_navigationportlet, remove_calendarportlet
        from ubify.policy.migration.onetimeinstall import setchoosertype, configureRatings, add_custom_site_properties, add_custom_cynin_properties
        from ubify.policy.migration.onetimeinstall import enable_formats_fortextfield, assignCyninNavigation, reorder_contenttyperegistry

        add_custom_site_properties(portal, logger)
        add_custom_cynin_properties(portal, logger)
        reorder_contenttyperegistry(portal, logger)
        setchoosertype(portal, logger)
        addDefaultCategories(portal, logger)
        assignStackerRelatedPortlet(portal)
        disableGlobalAdds(portal, logger)
        setup_sitehome_portlets(portal, logger)
        disable_inlineEditing(portal, logger)
        remove_navigationportlet(portal, logger)
        remove_calendarportlet(portal, logger)
        configureRatings(portal, logger)
        enable_formats_fortextfield(portal, logger)
        assignCyninNavigation(portal, logger)

    from ubify.policy.migration.onetimeinstall import updateWorkflowSecurity
    updateWorkflowSecurity(portal, logger)
    return out.getvalue()
Пример #4
0
def install(self,
 reinstall=False):
    """Install a set of products (which themselves may either use Install.py
    or GenericSetup extension profiles for their configuration) and then
    install a set of extension profiles.
    
    One of the extension profiles we install is that of this product. This
    works because an Install.py installation script (such as this one) takes
    precedence over extension profiles for the same product in 
    portal_quickinstaller. 
    
    We do this because it is not possible to install other products during
    the execution of an extension profile (i.e. we cannot do this during
    the importVarious step for this profile).
    """
    out = StringIO()
    from Products.GenericSetup.context import Logger,SetupEnviron
    import logging
    obj = SetupEnviron()
    logger = obj.getLogger("ubify.policy")
    outch = logging.StreamHandler(out)
    logger.addHandler(outch)
    
    #import pdb; pdb.set_trace()
    
    portal_quickinstaller = getToolByName(self, 'portal_quickinstaller')
    portal_setup = getToolByName(self, 'portal_setup')    
    
    if reinstall:        
        for product in PRODUCT_DEPENDENCIES:
            if not portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()
        for product in PRODUCT_DEPENDENCIES:
            if portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.reinstallProducts([product])
                transaction.savepoint()
            elif not portal_quickinstaller.isProductInstalled(product):
                portal_quickinstaller.installProduct(product)
                transaction.savepoint()
    else:
        for product in PRODUCT_DEPENDENCIES:
            if not portal_quickinstaller.isProductInstalled(product):
               logger.info("Installing missing product: %s" % product)
               portal_quickinstaller.installProduct(product)
               transaction.savepoint()
        
    for extension_id in EXTENSION_PROFILES:
        portal_setup.runAllImportStepsFromProfile('profile-%s' % extension_id, purge_old=False)
        product_name = extension_id.split(':')[0]
        portal_quickinstaller.notifyInstalled(product_name)
        transaction.savepoint()        
    
    #call one time installation here if reinstall is false
    portal = self
    
    
    if reinstall:
        
        for product in UNINSTALL_PRODUCTS:
            if portal_quickinstaller.isProductInstalled(product):
                try:                
                    from Products.CMFQuickInstallerTool.InstalledProduct import InstalledProduct
                    
                    prod=getattr(portal_quickinstaller,product)
                    prod.uninstall(cascade=InstalledProduct.default_cascade, reinstall=False)
                    logger.info("Uninstalled product successfully : %s" % (product,))
                except AttributeError:
                    pass
                transaction.savepoint()
        
        from ubify.policy.migration.onetimeinstall import disableGlobalAdds,reorder_contenttyperegistry
        reorder_contenttyperegistry(portal,logger)
        disableGlobalAdds(portal,logger)
    else:        
        from ubify.policy.migration.onetimeinstall import assignStackerRelatedPortlet,setup_sitehome_portlets
        from ubify.policy.migration.onetimeinstall import disableGlobalAdds,disable_inlineEditing
        from ubify.policy.setuphandlers import addDefaultCategories
        from ubify.policy.migration.onetimeinstall import remove_navigationportlet,remove_calendarportlet
        from ubify.policy.migration.onetimeinstall import setchoosertype,configureRatings,add_custom_site_properties,add_custom_cynin_properties
        from ubify.policy.migration.onetimeinstall import enable_formats_fortextfield,assignCyninNavigation,reorder_contenttyperegistry
        
        add_custom_site_properties(portal,logger)
        add_custom_cynin_properties(portal,logger)
        reorder_contenttyperegistry(portal,logger)
        setchoosertype(portal,logger)                        
        addDefaultCategories(portal,logger)
        assignStackerRelatedPortlet(portal)
        disableGlobalAdds(portal,logger)
        setup_sitehome_portlets(portal,logger)
#        disable_inlineEditing(portal,logger)
        remove_navigationportlet(portal,logger)
        remove_calendarportlet(portal,logger)
        configureRatings(portal,logger)
        enable_formats_fortextfield(portal,logger)
        assignCyninNavigation(portal,logger)
        
    from ubify.policy.migration.onetimeinstall import updateWorkflowSecurity
    updateWorkflowSecurity(portal,logger)
    return out.getvalue()
Пример #5
0
def importVarious(context):
    """Miscellanous steps import handle
    """
    
    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a 
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('ubify.policy_various.txt') is None:
        return

    portal = context.getSite()
    
    from Products.GenericSetup.context import Logger,SetupEnviron
    obj = SetupEnviron()
    logger = obj.getLogger("ubify.policy")
    
    replaceCatalog(portal)
    old_smtphost = disableMailHost(portal,logger)#<-- Do this first so that reinstallation will not fire any notifications if any
    oldmdh_smtphost = disableMaildropHost(portal,logger)
    
    configureSiteTitle(portal,logger)
    configureContentTypes(portal,logger)
    setup_folders(portal,logger)
    setVersionedTypes(portal,logger)
    setAbortVersioningOfLargeFiles(portal,logger)
    
    enable_wikitype(portal,logger)
    setupSiteTabs(context,logger)
    addGroups(context,logger)        
    addUsers(context,logger)
    
    #creating new content root item at site root
    setupContentRoot(portal,logger)
    
    configureCMFNotification(portal,logger)
    addRolesToListOfAllowedRolesToAddKeywords(portal,logger)
#    modifyKupuResourceTypes(portal,logger)
#    configureKupuToolbar(portal,logger)
#    allowembedtag(portal,logger)
#    configureKupuStyles(portal,logger)
    
    add_placeful_workflow_policy(portal,logger)    
    removeAnonymousAccessOnMembers(portal,logger)
    getViews(portal)
    
    addRecyleBinToUsePortalFactory(portal,logger)
    setRecycleBin(portal,logger)
    
    addDefaultViewsForPloneSite(portal,logger)
    renameDefaultEntries(portal,logger)
    
    migration_steps(portal,logger)
    
    startMigration(context,logger)       #<-- Migration step need to be last step before enabling MailHost    
    updateWorkflowSecurity(portal,logger)
    
    configureMailHost(portal,logger)
    configureMaildropHost(portal,logger)
    enableMaildropHost(portal,logger,oldmdh_smtphost)    
    enableMailHost(portal,logger,old_smtphost) #<-- Do this last so that mail smtp host configured before reinstallation will be maintained.
Пример #6
0
def importVarious(context):
    """Miscellanous steps import handle
    """

    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('ubify.policy_various.txt') is None:
        return

    portal = context.getSite()

    from Products.GenericSetup.context import Logger, SetupEnviron
    obj = SetupEnviron()
    logger = obj.getLogger("ubify.policy")

    replaceCatalog(portal)
    old_smtphost = disableMailHost(
        portal, logger
    )  #<-- Do this first so that reinstallation will not fire any notifications if any
    oldmdh_smtphost = disableMaildropHost(portal, logger)

    configureSiteTitle(portal, logger)
    configureContentTypes(portal, logger)
    setup_folders(portal, logger)
    setVersionedTypes(portal, logger)
    setAbortVersioningOfLargeFiles(portal, logger)

    enable_wikitype(portal, logger)
    setupSiteTabs(context, logger)
    addGroups(context, logger)
    addUsers(context, logger)

    #creating new content root item at site root
    setupContentRoot(portal, logger)

    configureCMFNotification(portal, logger)
    addRolesToListOfAllowedRolesToAddKeywords(portal, logger)
    modifyKupuResourceTypes(portal, logger)
    configureKupuToolbar(portal, logger)
    allowembedtag(portal, logger)
    configureKupuStyles(portal, logger)

    add_placeful_workflow_policy(portal, logger)
    removeAnonymousAccessOnMembers(portal, logger)
    getViews(portal)

    addRecyleBinToUsePortalFactory(portal, logger)
    setRecycleBin(portal, logger)

    addDefaultViewsForPloneSite(portal, logger)
    renameDefaultEntries(portal, logger)

    migration_steps(portal, logger)

    startMigration(
        context, logger
    )  #<-- Migration step need to be last step before enabling MailHost
    updateWorkflowSecurity(portal, logger)

    configureMailHost(portal, logger)
    configureMaildropHost(portal, logger)
    enableMaildropHost(portal, logger, oldmdh_smtphost)
    enableMailHost(
        portal, logger, old_smtphost
    )  #<-- Do this last so that mail smtp host configured before reinstallation will be maintained.