KeyError upgrading plone.directives.form from 1.0 to 1.1 on Plone 4.2
Héctor Velarde <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
yesterday, while upgrading collective.cover to version 1.0a9 on one of
our sites running Plone 4.2, we had to upgrade plone.directives.form
from 1.0 to 1.1 to avoid a GrokImportError similar to this one:
https://travis-ci.org/collective/collective.cover/jobs/30180163
and then we found an issue quite similar to the one described here:
http://plone.293351.n2.nabble.com/PicklingError-Can-t-pickle-lt-class-plone-directives-form-schema-Schema-gt-td7570785.html
as long as I understand, plone.directives.form version 1.1 introduces
some incompatibility that causes an error on the relations catalog;
according to David:
> A number of schema directives were moved to other packages and reimplemented
> to not depend on grok. The Schema class and the model, fieldset, and primary
> directives were moved to plone.supermodel.model. The omitted, no_omit, mode,
> widget, order_before, order_after, read_permission, and write_permission
> directives were moved to plone.autoform.directives.
>
> For now the directives are still available under their old names in this
> package, but they are deprecated and may be removed at some point.
https://pypi.python.org/pypi/plone.directives.form/1.1#id1
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.
I was thinking on adding an upgrade step on collective.cover, but then I
saw the comment of David about adding a BBB import and then I though
this have to be solved on plone.directives.form and not in collective.cover.
> When Schema moved to plone.supermodel.model we didn't
> leave a BBB alias because schema objects are classes and should never be
> persisted. Clearly that happened somehow, though, so if you want to add
> an backwards-compatibility import in plone.directives.form.schema now,
> I'm okay with that.
my question is, what would be the best way to solve this? add a BBB
import on plone.directives.form or dealing with a relations catalog
update that could be very expensive on some sites?
I think we will need a new release with this fix.
best regards
--
Héctor Velarde
------------------------------------------------------------------------------
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
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
smime.p7s
(application/pkcs7-signature, 3.7 KB) - not displayed