[Zope3-dev] IGroupFolder instead of isinstance?

Jim Fulton jim at zope.com
Tue Feb 22 18:05:58 EST 2005


Roger Ineichen wrote:
> Hi Jim, 
> Behalf Of Jim Fulton
> 
>>Sent: Tuesday, February 22, 2005 11:37 PM
>>To: dev at projekt01.ch
>>Cc: zope3-dev at zope.org
>>Subject: Re: [Zope3-dev] IGroupFolder instead of isinstance?
>>
>>Roger Ineichen wrote:
>>
>>>Is there a reason why we don't use a IGroupFolder interface?
>>>
>>>I see some problems for future implementations like described
>>>in the groupfolder.txt in zope.app.authentication.browser
>>>
>>>----
>>>[...] groups need to be defined in it's group folder. 
>>>Other groups folders or group-defining plugins could 
>>>define groups for a group.
>>>----
>>>
>>>because:
>>>
>>>In the class zope.app.authentication.groupfolder.py
>>>
>>>There is a check against a instance instead asking for 
>>>providing a interface?
>>>
>>>for name, groupfolder in groupfolders:
>>>        # It's annoying that we have to filter here, but there isn't
>>>        # a good reason for people to register group folder 
>>
>>utilities.
>>
>>>        if not isinstance(groupfolder, GroupFolder):
>>>               ^^^^^^^^^^
>>>            continue
>>>        principal.groups.extend(
>>>            groupfolder.getGroupsForPrincipal(principal.id),
>>>            )
>>>
>>>or are events more private and we have to implement own
>>>events for custom implementations? This looks like the event
>>>was added specialy for one implementation.
>>
>>*This* subscriber depends specifically on this group folder
>>implementation, which is why it tests for the implementation.
>>
>>A more general subscriber could use a more general test.
> 
> 
> Good to know,
> this means we really have to know the implementation of each event.
> 
> Ok I see, 
> this means we have something like public events and privat events?

*This* event subscriber's implementation depended on the groupfolder
implementation. That is an internal implementation decision of the
subscriber.  The implementor of an event subscriber needs to understand
the implementation of the subscriber, but, of course, there's nothing
deep in that. :)  Nobody but the implementor of a subscriber needs to
know it's implemnation.  This subscriber didn't depend on the implementation
of the event.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list