Re: KeyError upgrading plone.directives.form from 1.0 to 1.1 on Plone 4.2
Asko Soukka <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Héctor Velarde wrote:
> we solved the issue by reindexing the whole relations catalog using
> this code mentioned by Vincent on his answer:
>
> from plone import api
> from z3c.relationfield.event import updateRelations
> from z3c.relationfield.interfaces import IHasRelations
> from zc.relation.interfaces import ICatalog
> from zope.component import getUtility
>
>
> def reindex_relations(context):
> """Clear the relation catalog to fix issues with interfaces
> that don't
> exist anymore.
> """
> rcatalog = getUtility(ICatalog)
> rcatalog.clear()
> catalog = api.portal.get_tool('portal_catalog')
> brains =
> catalog.searchResults(object_provides=IHasRelations.__identifier__)
> for brain in brains:
> obj = brain.getObject()
> updateRelations(obj, None)
>
> and I took about half an hour to fix a site with around 50,000
> matching objects.
Possibly, the references to the missing classes are stored only in the
catalog object. In the best case, fixing the catalog would be only about
replacing a few keys or values there. May not be trivial, but the speed
difference would make it something to consider.
Regards
Asko
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Plone-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-developers