You are here: Home / Documentation / How To's / How to list the installed products in your Zope

How to list the installed products in your Zope

by nguyen — published Aug 16, 2016 10:50 AM, last modified Aug 16, 2016 10:50 AM
a script that iterates over the sites folders and Plone sites in your Zope, showing which products have been installed via quickinstaller

At the root of your Zope, add a Script(Python) object with the following body.  Call it ".listInstalledProducts" so that it appears before most other items in the ZMI view.

# Script to place in Zope root that shows which non-standard products
# are installed in all the contained Plone sites.

from Products.CMFCore.utils import getToolByName
uniqueDict = {}

productsToSkip = [ 'ATContentTypes', 'ATReferenceBrowserWidget', 'Archetypes', 'CMFActionIcons', 'CMFCalendar', 'CMFFormController', 'CMFPlacefulWorkflow', 'GroupUserFolder', 'MimetypesRegistry', 'PasswordResetTool', 'PlonePAS', 'PortalTransforms', 'ResourceRegistries', 'kupu', 'CMFSquidTool', 'Products.CMFSquidTool', 'CacheSetup']

for itemTuple in context.items():
 (item, itemType) = itemTuple
 if str(itemType).startswith('<PloneSite at '):
   site = getattr(context, item)
   pq = getToolByName(site, "portal_quickinstaller")
   print "Plone site '<a href='%s/portal_quickinstaller/manage_workspace'>%s quickinstaller</a>' or <a href='%s/portal_skins/custom/manage_workspace'>custom</a><br>" % (item, item, item)
   for product in pq.listInstalledProducts():
     pid = product['id']
     if pid not in productsToSkip:
       print "&nbsp;&nbsp;&nbsp;&nbsp;Has installed product '%s'<br>" % pid
       uniqueDict[pid] = 1

 if str(itemType).startswith('<Folder at '):
   folder = getattr(context, item)
   for folderItemTuple in folder.items():
     (folderItem, folderItemType) = folderItemTuple
     if str(folderItemType).startswith('<PloneSite at '):
       site = getattr(folder, folderItem)
       pq = getToolByName(site, "portal_quickinstaller")
       print "Plone site '<a href='%s/%s/portal_quickinstaller/manage_workspace'>%s</a>' or <a href='%s/%s/portal_skins/custom/manage_workspace'>custom</a><br>" % (folder.id, folderItem, folderItem, folder.id, folderItem)
       for product in pq.listInstalledProducts():
         pid = product['id']
         if pid not in productsToSkip:
           print "&nbsp;&nbsp;&nbsp;&nbsp;Has installed product '%s'<br>" % pid
           uniqueDict[pid] = 1

print "uniqueDict: %s" % "\n".join(uniqueDict.keys())
return printed
Navigation