AW: [Zope3-dev] Propose interface change (well not really)

Nicolas Évrard nicoe at altern.org
Thu Jul 8 19:44:54 EDT 2004


* Roger ineichen  [00:57 09/07/04 CEST]: 
>Jim Fulton wrote:
>> 
>> Roger, I'm confused. Are you talking about the principal 
>> source? Or the auth service?
>
>About the IPrincipalSource. I was lookig at the implementation of
>BTreePrincipalSource which is a sample of read/write principal source.
>Because it implements a IContainer. Then I was thinking of a
>read only principal source should at least provide IReadContainer.

Shouldn't it be "at most" (on the Container side, they can of course
provide others interfaces).

>But this isn't the case. I was wrong because that's just one implementation.
>with a BTree container. What do you think about to have a Interface for to
>add principals like setPrincipal(self, login, ob) instead of 
>__setitem__(self, login, ob)?

It think this is more neat than "source[login] = principal" because for
python programmers this idiom feels like a dictionnary and might give
a wrong feeling.

And why not having 2 interfaces:

    IReadOnlyPrincipalSource:

        def authenticate(): ....

        def getPrincipal(): ....

        def getPrincipals(): ....

    IWriteablePrincipalSource:

        def setPrincipal():
            "Addind and modifying a principal"

        def delPrincipal():
            "Deleting a principal"

How this is implemented is the choice of the principalsource
implementor. So althougt I think this might puzzle some people I still
like the "principalsource as a container" thing.

>Do we have to provide everywhere IContainer where we add object in Zope

No I don't think so. Some objects might have subobjects without
implementing all of the IContainer methods.

-- 
(°>  Nicolas Évrard
/ )  Liège - Belgique
^^   Listening to: Rings around Saturn (Peshay & Decoder remix)
                   Photek


More information about the Zope3-dev mailing list