How to force all your old content into the new 'normalized-id-format'
Here's a simple script you can use.
- Create a 'Script (Python)'
- Paste this in there:
stuff = []
u = context.plone_utils
for r in context.portal_catalog(path='/path/to/content'):
stuff.append(r.getPath())
stuff.sort()
stuff.reverse()
for f in stuff:
parts = f.split('/')
parent, fname = parts[:-1], parts[-1]
fname, normalized = fname, u.normalizeString(fname)
if fname != normalized:
p = context.restrictedTraverse(parent)
p.manage_renameObjects(ids=[fname], new_ids=[normalized])
print fname, normalized
print 'done'
return printed
Now, run the script and have fun! :)
