Philipp von Weitershausen <[EMAIL PROTECTED]> writes:

> > I don't think I would like to redesign my objects just because the
> > addIntIdSubscriber does not catch NotYet when getting IKeyReference:
> > 
> >  <at> adapter(ILocation, IObjectAddedEvent)
> > def addIntIdSubscriber(ob, event):
> >     # ...
> >     utilities = tuple(getAllUtilitiesRegisteredFor(IIntIds))
> >     if utilities: # assert that there are any utilites
> >         key = IKeyReference(ob, None) # HERE IS RAISED EXCEPTION
> >         # ...
> > 
> 
> Why not write a custom IKeyReference adapter that doesn't raise the 
> exception? You could even let the adaption fail completely so that the 
> addIntIdSubscriber gets a None for 'key' and doesn't proceed:
> 
>  <at> adapter(YourClass)
> def keyReference(obj):
>      return None # adaption failed on purpose, don't want key references
> 

Yeah, you are right! This looks as the simplest solution, much simpler than
overriding addIntIdSubscriber in some way (if it is possible, which I'm not 
sure)

Warm regards!
Alek

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to