Esempio n. 1
0
def QI_uninstallProducts(self, products=[],
                         cascade=InstalledProduct.default_cascade,
                         reinstall=False, REQUEST=None):
    """ make zpublisher happy """

    changed = False
    curr_sm = getSiteManager()
    bases = list(curr_sm.__bases__)       

    prods = []

    for pid in products:
        reg = config.getRegistry(pid)
        if reg is not None:
            if reg in bases:
                changed = True
                bases.remove(reg)
        else:
            prods.append(pid)
        
    if changed:
        curr_sm.__bases__ = tuple(bases)

    if prods:
        orig_uninstallProducts(self, prods, cascade, reinstall, REQUEST)
    elif REQUEST is not None:
        return REQUEST.RESPONSE.redirect(REQUEST['HTTP_REFERER'])
Esempio n. 2
0
def QI_installProduct(self, p, locked=False, hidden=False,
                      swallowExceptions=None, reinstall=False,
                      forceProfile=False, omitSnapshots=True, profile=None):

    reg = config.getRegistry(p)
    if reg is not None:
        sm = getSiteManager()
        sm.__bases__ = (reg,) + sm.__bases__
        return

    return orig_installProduct(self, p, locked, hidden, swallowExceptions, 
                               reinstall, forceProfile, omitSnapshots, profile)
Esempio n. 3
0
def QI_listInstallableProducts(self, skipInstalled=True):
    addons = orig_listInstallableProducts(self, skipInstalled)

    curr_sm = getSiteManager()

    has = False
    for sm in config.getRegistry():
        if sm.addon and sm not in curr_sm.__bases__:
            has = True
            addons.append(
                {'title': sm.title, 'description': sm.description,
                 'status': 'new', 'hasError': False, 'id': sm.__name__})
    if has:
        addons.sort(key = lambda i: i['title'])
    return addons
Esempio n. 4
0
def QI_isProductAvailable(self, pid):
    reg = config.getRegistry(pid)
    if reg is not None:
        return True

    return orig_isProductAvailable(self, pid)
Esempio n. 5
0
def QI_upgradeInfo(self, pid):
    reg = config.getRegistry(pid)
    if reg is not None:
        return {'required': False}

    return orig_upgradeInfo(self, pid)