[Zope-dev] Resource Discovery (was Observer / Notification Interface Proposal) Proposal)

Anthony Baxter Anthony Baxter <anthony@interlink.com.au>
Fri, 26 May 2000 10:03:28 +1000


>>> "Phillip J. Eby" wrote
> >In our case, perhaps it needs to be::
> >
> >   def findNearestResource( meta_type ):
> >
> >which causes a walk up the containment hierarchy, searching for objects
> >of the given meta_type.
>
> I would suggest that it ask for an interface, rather than a meta_type.
> Otherwise, you've hardwired yourself into a single object type with no
> extensibility.  For example, an SQL method wants the nearest SQL
> connection, but shouldn't have to explicitly ask for each kind of SQL
> connection (Sybase, Oracle, etc.)

In that case, would you have a matching call in the observer objects 
where they can specify what it is that they offer? Rather than basing it
on type, you'd say 'find the nearest resource that wants to know about
blah'. 

Anthony