Personal tools
You are here: Home Documentation How To's How to list all the sites in a Zope

How to list all the sites in a Zope

by T. Kim Nguyen last modified Sep 09, 2009 12:06 PM

.listSites

# Script to place in Zope root that lists all the contained Plone sites.

uniqueDict = {}

for itemTuple in context.items():
 (item, itemType) = itemTuple
 if str(itemType).startswith('<PloneSite at '):
   site = getattr(context, item)
   print "Plone site <a href=\"%s\">%s</a>: " % (site.portal_url()+'/manage_propertiesForm', site.id)
   print "<br>"
 elif str(itemType).startswith('<Folder at '):
   folder = getattr(context, item)
   print "<h1><a href='%s/manage_main' target='_blank_'>%s</a></h1>" % (folder.absolute_url(), item)
   for folderItemTuple in folder.items():
     (folderItem, folderItemType) = folderItemTuple
     if str(folderItemType).startswith('<PloneSite at '):
       site = getattr(folder, folderItem)
       print "Plone site <a href=\"%s\">%s</a>: " % (site.portal_url()+'/manage_propertiesForm', site.id)
       print "<br>"
    
return printed
Document Actions
  • Print this
  • Bookmarks