def testSlotsMigration(self):
        from Products.CMFQuickInstallerTool.InstalledProduct import \
            InstalledProduct
        # leftslots and rightslots have been class variables ones. Make sure
        # using old instances without these properties doesn't break.

        # New instances should have the properties
        new = InstalledProduct('new')
        self.assertTrue(hasattr(new, 'leftslots'))
        self.assertTrue(hasattr(new, 'rightslots'))

        # Now emulate an old instance
        old = InstalledProduct('old')
        del(old.leftslots)
        del(old.rightslots)

        # Make sure calling the API will give you no error but silently
        # add the property
        left = old.getLeftSlots()
        self.assertTrue(left == [])
        self.assertTrue(old.leftslots == [])

        right = old.getRightSlots()
        self.assertTrue(right == [])
        self.assertTrue(old.rightslots == [])

        slots = old.getSlots()
        self.assertTrue(slots == [])
Beispiel #2
0
    def testSlotsMigration(self):
        # leftslots and rightslots have been class variables ones. Make sure
        # using old instances without these properties doesn't break.

        # New instances should have the properties
        new = InstalledProduct("new")
        self.failUnless(hasattr(new, "leftslots"))
        self.failUnless(hasattr(new, "rightslots"))

        # Now emulate an old instance
        old = InstalledProduct("old")
        del (old.leftslots)
        del (old.rightslots)

        # Make sure calling the API will give you no error but silently
        # add the property
        left = old.getLeftSlots()
        self.failUnless(left == [])
        self.failUnless(old.leftslots == [])

        right = old.getRightSlots()
        self.failUnless(right == [])
        self.failUnless(old.rightslots == [])

        slots = old.getSlots()
        self.failUnless(slots == [])
Beispiel #3
0
    def test_uninstall_method_is_available(self):
        product = InstalledProduct(self.package)
        self.assertIsNotNone(
            product.getUninstallMethod(),

            'The package "{0}" has no uninstall external method defined,'
            ' or there is an error (e.g. ImportError) in your external'
            ' method, which might be swallowed silently by quick installer.'
            ' Take a look at the ftw.contentpage package for an example.'
            .format(self.package))
    def test_upgrade_2003(self):
        qi = self.layer['portal'].portal_quickinstaller
        from Products.CMFQuickInstallerTool.InstalledProduct import InstalledProduct
        ip = InstalledProduct('foo')
        ip.utilities = [('zope.intid.interfaces.IIntIds', '')]
        qi._setObject('foo', ip)

        from plone.app.dexterity.upgrades.to2003 import fix_installed_products
        fix_installed_products(self.layer['portal'])

        self.assertEqual([], ip.utilities)
    def test_upgrade_2003(self):
        qi = self.layer['portal'].portal_quickinstaller
        from Products.CMFQuickInstallerTool.InstalledProduct import InstalledProduct
        ip = InstalledProduct('foo')
        ip.utilities = [('zope.intid.interfaces.IIntIds', '')]
        qi._setObject('foo', ip)

        from plone.app.dexterity.upgrades.to2003 import fix_installed_products
        fix_installed_products(self.layer['portal'])

        self.assertEqual([], ip.utilities)
Beispiel #6
0
def _instala_pacote(qi, package):
    if package not in qi.objectIds():
        ip = InstalledProduct(package)
        qi._setObject(package, ip)

    p = getattr(qi, package)
    p.update({}, locked=False, hidden=False, **{})
Beispiel #7
0
    def test_upgrade_2003(self):
        from plone.app.dexterity.upgrades.to2003 import fix_installed_products
        from Products.CMFCore.utils import getToolByName
        try:
            from Products.CMFQuickInstallerTool.InstalledProduct import \
                InstalledProduct
        except ImportError:
            # nothing to test
            return
        qi = getToolByName(self.layer['portal'], 'portal_quickinstaller', None)
        if qi is None:
            # nothing to test
            return
        ip = InstalledProduct('foo')
        ip.utilities = [('zope.intid.interfaces.IIntIds', '')]
        qi._setObject('foo', ip)

        fix_installed_products(self.layer['portal'])

        self.assertEqual([], ip.utilities)
    def test_upgrade_2003(self):
        from plone.app.dexterity.upgrades.to2003 import fix_installed_products
        from Products.CMFCore.utils import getToolByName
        try:
            from Products.CMFQuickInstallerTool.InstalledProduct import \
                InstalledProduct
        except ImportError:
            # nothing to test
            return
        qi = getToolByName(self.layer['portal'], 'portal_quickinstaller', None)
        if qi is None:
            # nothing to test
            return
        ip = InstalledProduct('foo')
        ip.utilities = [('zope.intid.interfaces.IIntIds', '')]
        qi._setObject('foo', ip)

        fix_installed_products(self.layer['portal'])

        self.assertEqual([], ip.utilities)
    def notifyInstalled(self, p, locked=True, hidden=False, settings={}, **kw):
        """Marks a product that has been installed
        without QuickInstaller as installed
        """

        if p not in self.objectIds():
            ip = InstalledProduct(p)
            self._setObject(p, ip)

        p = getattr(self, p)
        p.update(settings, locked=locked, hidden=hidden, **kw)
Beispiel #10
0
    def testSlotsMigration(self):
        # leftslots and rightslots have been class variables ones. Make sure
        # using old instances without these properties doesn't break.

        # New instances should have the properties
        new = InstalledProduct('new')
        self.failUnless(hasattr(new, 'leftslots'))
        self.failUnless(hasattr(new, 'rightslots'))

        # Now emulate an old instance
        old = InstalledProduct('old')
        del (old.leftslots)
        del (old.rightslots)

        # Make sure calling the API will give you no error but silently
        # add the property
        left = old.getLeftSlots()
        self.failUnless(left == [])
        self.failUnless(old.leftslots == [])

        right = old.getRightSlots()
        self.failUnless(right == [])
        self.failUnless(old.rightslots == [])

        slots = old.getSlots()
        self.failUnless(slots == [])
Beispiel #11
0
            )

        jstool = getToolByName(self,'portal_javascripts', None)
        if jstool is not None:
            settings['resources_js']=[r for r in resources_js_after if r not in resources_js_before]
            settings['resources_css']=[r for r in resources_css_after if r not in resources_css_before]
            if len(settings['types']) > 0:
                rr_css=getToolByName(portal,'portal_css')
                rr_css.cookResources()

        msg=str(res)
        version=self.getProductVersion(p)
        # add the product
        try:
            if p not in self.objectIds():
                ip = InstalledProduct(p)
                self._setObject(p,ip)
                
            ip = getattr(self, p)
            ip.update(settings,
                      installedversion=version,
                      logmsg=res,
                      status=status,
                      error=error,
                      locked=locked,
                      hidden=hidden,
                      afterid = after_id,
                      beforeid = before_id
                      )

        except InvalidObjectReference,e: