[Zope3-dev] Re: a new zcml directive?

Jim Fulton jim at zope.com
Wed Mar 15 13:07:25 EST 2006


Martijn Faassen wrote:
> Jim Fulton wrote:
> 
...
>>    If a factory is not a class, and if it allows attributes to be
>>    set on it, then the interface.implementor function can be used to make
>>    declarations for it.  This is documeted in zope/interfaces/README.txt
>>    and zope/component/README.txt.
> 
> 
> This is one bit I was missing, thanks.
> 
> Unfortunately I read in zope/interface/README.txt that the 'implementer' 
> function cannot be used for classes yet, so this will change the design 
> somewhat (I was using __call__, looks like I'll have to exploit lexical 
> scoping and generate a function on the fly).

No.  You can use it on an instance of the class.  You want something
like:

   class FactoryFactory:

       def __init__(self):
	  # initialize a new factory
	  ...
           implementer(self, someinterfacethatmyinstancesimplement)

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