[Zope3-dev] Re: Zope 3 Source organization

Phillip J. Eby pje@telecommunity.com
Tue, 15 Jul 2003 09:56:51 -0400


At 09:21 PM 7/14/03 -0500, Philipp von Weitershausen wrote:
>As much of a pain it is right now, I'd like to keep the current 
>convention. Interfaces need to be separated from implementation, unless we 
>invent something like global identifiers like Shane suggested 
>(http://mail.zope.org/pipermail/zope3-dev/2003-July/007522.html). I've 
>been wanting to write a proposal on this (was on vacation till today).

For what it's worth, this mechanism could be trivially implemented atop 
PyProtocols; a simple mapping of strings to protocol objects would 
suffice.  I could add a 'protocolForURI()' function to do this, and then 
you could define a concrete Zope interface that was equivalent to the 
"string" protocol, e.g.:

import protocols
from zope.interface import Interface

SomeInterfaceURI = 
protocols.protocolForURI('http://www.zope.org/Zope3/SomeInterface')

class SomeInterface(Interface):

     protocols.advise(
         protocolImplies = [SomeInterfaceURI],
         protocolExtends = [SomeInterfaceURI]
     )

     # interface body goes here

This would be in a module that supplied the interface.  Packages (bundles?) 
that simply depended on the interface would use the 'protocolForURI()' 
instead of the actual interface object.

Of course, a practical consideration here is that one would have to be able 
to use PyProtocols protocols as Z3CA registry keys.