Logo Search packages:      
Sourcecode: zope-cmfquickinstallertool version File versions

def zope-cmfquickinstallertool-1.5.0::InstalledProduct::InstalledProduct::uninstall (   self,
  cascade = default_cascade,
  REQUEST = None 
)

uninstalls the prod and removes its deps

Definition at line 194 of file InstalledProduct.py.

00194                                                             :
        '''uninstalls the prod and removes its deps'''

        portal=getToolByName(self,'portal_url').getPortalObject()

        #XXX eventually we will land Event system and could remove this 'removal_inprogress' hack
        if self.isLocked() and getattr(portal, 'removal_inprogress', 0):
            raise ValueError, 'The product is locked and cannot be uninstalled!'

        res=''

        uninstaller=self.getUninstallMethod()

        if uninstaller:
            res=uninstaller(portal)

        if 'types' in cascade:
            portal_types=getToolByName(self,'portal_types')
            delObjects(portal_types, self.types)

        if 'skins' in cascade:
            portal_skins=getToolByName(self,'portal_skins')
            delObjects(portal_skins, self.skins)

        if 'actions' in cascade:
            portal_actions=getToolByName(self,'portal_actions')
            actids= [o.id.lower() for o in portal_actions._actions]
            delactions=[actids.index(id) for id in self.actions if id in actids]
            if delactions: portal_actions.deleteActions(delactions)

        if 'portalobjects' in cascade:
            delObjects(portal, self.portalobjects)

        if 'workflows' in cascade:
            portal_workflow=getToolByName(self,'portal_workflow')
            delObjects(portal_workflow, self.workflows)

        if 'slots' in cascade:
            if self.leftslots:
                portal.left_slots=[s for s in portal.left_slots if s not in self.leftslots]
            if self.rightslots:
                portal.right_slots=[s for s in portal.right_slots if s not in self.rightslots]

        if 'registrypredicates' in cascade:
            registry=getToolByName(self,'content_type_registry')
            predicates=getattr(self,'registrypredicates',[])
            for p in predicates:
                registry.removePredicate(p)


        self.status='uninstalled'
        self.log('uninstalled\n'+str(res))

        if REQUEST and REQUEST.get('nextUrl',None):
            return REQUEST.RESPONSE.redirect(REQUEST['nextUrl'])

    def getInstalledVersion(self):


Generated by  Doxygen 1.6.0   Back to index