Skip to content

Instantly share code, notes, and snippets.

@do3cc
Created May 13, 2014 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save do3cc/1179ebaa8de24247eb75 to your computer and use it in GitHub Desktop.
Save do3cc/1179ebaa8de24247eb75 to your computer and use it in GitHub Desktop.
Repair CMFEditions quick and dirty
from Products.CMFEditions.ZVCStorageTool import Removed
zvc_repo = app.Plone2.portal_historiesstorage.zvc_repo
for shadow_history in app.Plone2.portal_historiesstorage._shadowStorage._storage.values():
for version in shadow_history._full.values():
if not 'referenced_data' in version:
continue
vc_info = version['vc_info']
zope_version = zvc_repo._histories[vc_info.history_id]._versions[vc_info.version_id]
if isinstance(Removed, zope_version._data._object):
del version['referenced_data']
shadow_history._full._p_changed = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment