[Zope3-dev] IGroupFolder instead of isinstance?

Jim Fulton jim at zope.com
Tue Feb 22 17:36:53 EST 2005


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.

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