I have a couple of broken objects that I wish to loop through in python script. My use case is as follows: I have renamed my custom product from my.oldproduct
to my.newproduct
. This has caused the previous objects saved with my.oldproduct
to be broken and thus inaccessible. There is a workaround to this as detailed here: Updating broken objects
Now what I want to do is create a python script in the ZMI to loop though all the broken content, change/update them, and thus cause them to be saved using my.newproduct.
I've been unable get the old objects as they are not listed. See a sample of my python script to list all the content in the site, yet they still do not show:
from Products.CMFCore.utils import getToolByName
app = context.restrictedTraverse('/')
sm = app.plone.getSiteManager()
catalog = getToolByName(context, 'portal_catalog')
results = catalog.searchResults()
count = 0
for obj in results:
print obj.meta_type
count += 1
print str("Found " + str(count) + " matching objects")
return printed
How can I get the broken objects from my.oldproduct
to be listed?