【问题标题】:Plone- ComponentLookUpError is preventing me from deleting Plone site?Plone- ComponentLookUpError 阻止我删除 Plone 站点?
【发布时间】:2017-03-23 18:26:19
【问题描述】:

我正在尝试删除我正在测试的 Plone 站点。但是,当我删除它时,我得到一个错误。

从控制台:

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 OFS.ObjectManager, line 540, in manage_delObjects
  Module OFS.ObjectManager, line 391, in _delObject
  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 OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
  Module zope.container.contained, line 153, in dispatchToSublocations
  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 OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
  Module zope.container.contained, line 153, in dispatchToSublocations
  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 OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
  Module zope.container.contained, line 153, in dispatchToSublocations
  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 OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
  Module zope.container.contained, line 153, in dispatchToSublocations
  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 OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
  Module zope.container.contained, line 153, in dispatchToSublocations
  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 Products.CMFCore.CMFCatalogAware, line 271, in handleContentishEvent
  Module Products.CMFCore.CMFCatalogAware, line 76, in unindexObject
  Module Products.CMFCore.CatalogTool, line 280, in unindexObject
  Module Products.CMFPlone.CatalogTool, line 354, in uncatalog_object
  Module Products.ZCatalog.ZCatalog, line 508, in uncatalog_object
  Module Products.ZCatalog.Catalog, line 383, in uncatalogObject
  Module Products.PluginIndexes.common.UnIndex, line 286, in unindex_object
  Module Products.PluginIndexes.UUIDIndex.UUIDIndex, line 98, in removeForwardIndexEntry
  Module z3c.relationfield.relation, line 79, in __cmp__
  Module z3c.relationfield.relation, line 82, in _sort_key
  Module z3c.relationfield.relation, line 31, in from_path
  Module plone.app.relationfield.monkey, line 14, in get_from_object
  Module z3c.relationfield.relation, line 110, in _object
  Module zope.component._api, line 169, in getUtility
ComponentLookupError: (<InterfaceClass zope.intid.interfaces.IIntIds>, '')

页面刚刚显示:

 (<InterfaceClass zope.intid.interfaces.IIntIds>, '') 

我确实在事件订阅者中使用了 IIntIds,我想知道这是否可能是问题所在。

当特定内容类型的对象转换时,将创建另一个内容类型的另一个对象,并且我使用 IIntIds 实用程序从创建的对象中“获取”一个关系值。 RelationValue 附加到对象转换的相关项。 创建的对象也有relatedItems,我得到对象转换的关系值并将其附加到创建的对象的relatedItems。

在configure.zcml中:

  <subscriber
  for="my.product.myobject.MyObject          
       Products.DCWorkflow.interfaces.IAfterTransitionEvent" 
  handler=".events.myObjectTransitioned" />     

在 events.py 中:

def myObjectTransitioned(obj,event):

    ....
    action = event.status['complete']
    if action == 'activate':
        .....
        try:
            new_obj = api.content.create(container=OtherObjs,portal_type='my.object.anotherobject',
               title=a_concat_title, id=a_concat_title)
            int_ids = getUtility(IIntIds)

            obj.relatedItems.append(RelationValue(int_ids.getId(new_obj)))
            new_obj.relatedItems.append(RelationValue(int_ids.getId(obj)))

            obj.reindexObject()
            new_obj.reindexObject()
        except:
            print "failed creation"            

我遇到了一个类似的问题,其中一个答案提到没有安装 plone.app.relationfield 或 plone.app.intId。我有 plone.app.relationfield (RelationValue) 和 plone.app.intId (plone.app.intid: install utility)。

我基本上这样做是为了让 new_obj 可以通过方便地调用 to_object 从 obj(转换对象)获取信息,反之亦然。但是,我猜这是导致此错误的原因,我应该为 new_obj 从 obj 获取信息使用反向引用?

【问题讨论】:

  • 如果我没有提供足够的细节或者这是一个重复的问题,我很抱歉,但很遗憾我迷路了。
  • 您在我们的论坛community.plone.org(更多的眼球)上发布问题可能会更好,尽管我会在论坛上发布您问题的链接。
  • 很遗憾没有足够的信息来帮助您;我认为当您尝试删除站点时,可能会调用一些事件订阅者;您应该尝试定位违规事件并跳过其 ZCML 注册;重启实例并重试。
  • @T.KimNguyen 感谢您发布问题的链接。我很感激。我会尝试在那里发帖。
  • @hvelarde 感谢您的回复。我在想可能是这样的。如果我发现了,我会分享。

标签: plone plone-4.x


【解决方案1】:

基本上阻止您删除网站的是每次触发的事件(运行您提到的麻烦代码)。为了防止这种行为,我可以建议执行以下操作:

$ cd {buildout-dir}
$ bin/zopepy
> from transaction import commit
> app._delObject('Plone', suppress_events=True)
> commit()

一般来说,不建议对 Plone 站点中的对象执行此操作,因为这还会阻止 portal_catalog 更新并导致其他副作用。但是当您将整个网站删除时,这并不重要。

【讨论】:

  • 感谢您的回复。感谢您抽出宝贵的时间。我最终发现另一个产品中存在另一个关于关系值破坏的问题。但我很感激你分享这个。对于我来说,它是删除 data.fs 的更方便的替代方法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-03
  • 1970-01-01
  • 1970-01-01
  • 2011-10-10
  • 1970-01-01
相关资源
最近更新 更多