[Zope-CMF] Re: Delete trouble

Martin Aspeli optilude at gmx.net
Sun Mar 25 07:46:15 EDT 2007


Philipp von Weitershausen wrote:
> 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:
>        ...

I agree, except I think there could potentially be lots of places where 
this could be happening. In the general case, it's probably safe for 
that code to assume the utility is there, and treat it as an error if 
it's not, but during site deletion, it is probably at the mercy of the 
order of deletions. At least that's my guess.

It *could* also be a site manager/traversal issue, I guess - I'm one 
level above the Plone site when I delete this, so possibly it's not 
finding the right site manager? Not sure how that works...\

Martin



More information about the Zope-CMF mailing list