[Zope-CMF] Re: Delete trouble

Miles miles at jamkit.com
Wed Mar 28 05:54:03 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 think I have a patch that will sort this out.  The issue is that the 
UID annotations define a manage_beforeDelete method that is called via 
subscribers to the IOpaqueItemEvents interface, but, being "old zope", 
doesn't know whether it is being deleted or moved and does some lookups 
that are unnecessary when deleted.

Changing this so there is an event subscriber for UIDs that does not use 
manage_beforeDelete will sort the problem, as nothing will be done when 
the item is deleted.

I don't know whether there is a wider issue around BBB and the order 
that events are fired though (manage_beforeDelete looks to have had a 
'children first' approach, whereas it looks as if dispatchToSublocations 
has a 'children last' approach)

Miles



More information about the Zope-CMF mailing list