[Zope3-dev] EventService, references, and subscription semantics

Shane Hathaway shane@zope.com
Mon, 25 Feb 2002 18:10:24 -0500


Steve Alexander wrote:
> Shane Hathaway wrote:
> 
>> class IReference (Interface):
>>     """Provides a way to find an object without necessarily keeping a
>>     strong reference."""
>>
>>     def dereference(context):
>>         """Returns the referenced object."""
> 
> 
> <deletia>
> 
>> The nice thing is you can encapsulate both strong and weak references 
>> this way.  The reference could hold an absolute path, a relative path, 
>> the object itself, a URL, a database query, etc.
> 
> 
> The nice thing with Zope 3 is that we can define an IReferenceLookup 
> utility, so we can ask for an IReference adapter for a particular 
> object, and get an appropriate IReference.

Well, I may be wrong, but I don't think you can go that far.  If you 
have a persistent LDAP-backed user database and you want to register an 
LDAP-based user object as an event listener (perhaps to expire the 
user's password), how would the IReferenceLookup utility know to use a 
path/userid-based reference as opposed to a persistence-based reference 
or an LDAP-based reference?  The only interface of the user objects is 
IPrincipal.

Shane