[Zope-CMF] Re: Delete trouble
Philipp von Weitershausen
philipp at weitershausen.de
Sun Mar 25 01:20:09 EDT 2007
Martin Aspeli wrote:
> Traceback (innermost last):
> Module ZPublisher.Publish, line 119, in publish
> Module ZPublisher.mapply, line 88, in mapply
> Module ZPublisher.Publish, line 42, in call_object
> Module OFS.ObjectManager, line 524, in manage_delObjects
> Module OFS.ObjectManager, line 379, in _delObject
> Module zope.event, line 23, in notify
> Module zope.component.event, line 26, in dispatch
> Module zope.component._api, line 130, in subscribers
> Module zope.component.registry, line 290, in subscribers
> Module zope.interface.adapter, line 535, in subscribers
> Module zope.component.event, line 33, in objectEventNotify
> Module zope.component._api, line 130, in subscribers
> Module zope.component.registry, line 290, in subscribers
> Module zope.interface.adapter, line 535, in subscribers
> Module OFS.subscribers, line 108, in dispatchObjectWillBeMovedEvent
> Module zope.app.container.contained, line 182, in dispatchToSublocations
> Module zope.component._api, line 130, in subscribers
> Module zope.component.registry, line 290, in subscribers
> Module zope.interface.adapter, line 535, in subscribers
> Module OFS.subscribers, line 108, in dispatchObjectWillBeMovedEvent
> Module zope.app.container.contained, line 182, in dispatchToSublocations
> Module zope.component._api, line 130, in subscribers
> Module zope.component.registry, line 290, in subscribers
> Module zope.interface.adapter, line 535, in subscribers
> Module Products.CMFCore.CMFCatalogAware, line 285, in
> dispatchToOpaqueItems
> Module zope.component._api, line 130, in subscribers
> Module zope.component.registry, line 290, in subscribers
> Module zope.interface.adapter, line 535, in subscribers
> Module Products.CMFCore.CMFCatalogAware, line 306, in
> handleOpaqueItemEvent
> Module Products.CMFUid.UniqueIdAnnotationTool, line 87, in
> manage_beforeDelete
> Module zope.component._api, line 207, in getUtility
> ComponentLookupError: (<InterfaceClass
> Products.CMFUid.interfaces.IUniqueIdAnnotationManagement>, '')
The UniqueIDAnnotationTool should probably do a *query*Utility (which
will return None in case the utility can't be found) and simply not do
anything in such a case. The canonical way of expressing such fail-safe
routines is therefore:
component = query{Utility|Adapter|MultiAdapter}(...)
if component is not None:
...
--
http://worldcookery.com -- Professional Zope documentation and training
More information about the Zope-CMF
mailing list