Erro ao editar notícia ou executar um upgradeStep brasil.gov.tiles v4100 da versão 1.0.5/1.5.1 para 2.1.1: Could not adapt Products.Archetypes.interfaces.referenceable.IReferenceable
monicakrs opened this issue · comments
Prezados,
Migrei o meu site para da versão 1.0.5 para 1.5.1 e por fim para 2 .1 .1
Estou obtendo o seguinte erro ao tentar editar uma notícia. Sabem como posso solucionar esse problema?
Aqui está a mensagem de erro completa:
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module plone.z3cform.layout, line 66, in __call__
Module plone.z3cform.layout, line 50, in update
Module plone.dexterity.browser.edit, line 64, in update
Module plone.z3cform.fieldsets.extensible, line 59, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 145, in update
Module plone.app.z3cform.csrf, line 21, in execute
Module z3c.form.action, line 98, in execute
Module z3c.form.button, line 315, in __call__
Module z3c.form.button, line 170, in __call__
Module plone.dexterity.browser.edit, line 28, in handleApply
Module z3c.form.group, line 126, in applyChanges
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module zope.component.event, line 32, in objectEventNotify
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module plone.app.referenceablebehavior.uidcatalog, line 51, in modified_handler
Module Products.Archetypes.UIDCatalog, line 188, in catalog_object
__traceback_info__: ('<Reference sid:e7d57bfde94844adae722bc3775b9fb7 tid:72e750065b7c4abdb0fd8a1df75f9b93 rel:isReferencing>', 'noticias/ouvidoria-geral-da-uniao-e-rede-de-ouvidorias-se-unem-para-promover-a-maior-acao-integrada-de-ouvidoria-ja-realizada/at_references/f1fec136e9c74a8f9bd45ac4e0b890e8')
Module Products.ZCatalog.ZCatalog, line 476, in catalog_object
Module Products.ZCatalog.Catalog, line 340, in catalogObject
Module Products.ZCatalog.Catalog, line 284, in updateMetadata
Module Products.ZCatalog.Catalog, line 410, in recordify
Module Products.Archetypes.ReferenceEngine, line 100, in targetId
Module plone.app.referenceablebehavior.referenceable, line 29, in getTargetObject
TypeError: ('**Could not adapt**', <Image at imagens/brasil-acao-global-1.png>, <InterfaceClass Products.Archetypes.interfaces.referenceable.IReferenceable>)
Esse erro ocorre porque o tipo de conteúdo Image
não possui o comportamento definido pela interface Products.Archetypes.interfaces.referenceable.IReferenceable
, por isso o erro Could not adapt
.
Esse erro também ocorre dependendo dos links feitos na sua instalação quando rodamos os upgradeSteps de uma versão 1.5.x para 2.x:
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.GenericSetup.tool, line 1053, in manage_doUpgrades
Module Products.GenericSetup.upgrade, line 166, in doStep
Module brasil.gov.tiles.upgrades.v4100, line 153, in migrate_tiles_data_removed
Module brasil.gov.tiles.upgrades, line 98, in replace_attribute_data
Module collective.cover.tiles.data, line 64, in set
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module zope.component.event, line 32, in objectEventNotify
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module plone.app.referenceablebehavior.uidcatalog, line 51, in modified_handler
Module Products.Archetypes.UIDCatalog, line 188, in catalog_object
__traceback_info__: ('<Reference sid:9abdbc3ff7eb48beb91c8b7719883ac6 tid:2b6e7318ca2542c8aa1127deb921f8b6 rel:isReferencing>', 'item/at_references/588a72d2d1a546a28cdf0a05bf474cbc')
Module Products.ZCatalog.ZCatalog, line 476, in catalog_object
Module Products.ZCatalog.Catalog, line 334, in catalogObject
Module Products.ZCatalog.Catalog, line 284, in updateMetadata
Module Products.ZCatalog.Catalog, line 410, in recordify
Module Products.Archetypes.ReferenceEngine, line 100, in targetId
Module plone.app.referenceablebehavior.referenceable, line 29, in getTargetObject
TypeError: ('Could not adapt', <Image at image.png>, <InterfaceClass Products.Archetypes.interfaces.referenceable.IReferenceable>)
Precisamos estudar direito o que aconteceu para ver se o correto seria criar mais um upgradeStep para evitar que esse tipo de erro aconteça.
Um paliativo: tente, com usuário Manager
, acessar dexterity-types/Image/@@behaviors
e selecionar o comportamento Referenceable by Archetypes
. Pode ser que seja necessário fazer isso para outros tipos (por exemplo em dexterity-types/Folder/@@behaviors
), dependendo das referências que foram feitas na sua instalação e nos seus conteúdos.
Recentemente atualizamos nosso portal da 1.1.5.1 para 1.5.3
Ao editar alguns conteúdos estamos com o mesmo problema de 'Could not adapt'
O problema não é exclusivo da 2.x
@idgserpro : Depois dessa solução paliativa de adicionar o comportamento IReferenceable aos tipos com problema, seria necessário arrumar os UUID duplicados?
https://docs.plone.org/develop/plone/content/uid.html#uuid-acquisition-problem-with-dexterity-content-types