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

Martijn Faassen faassen at infrae.com
Wed Mar 15 13:25:33 EST 2006


Jim Fulton wrote:
> Martijn Faassen wrote:
> 
>> Jim Fulton wrote:

>> 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)

I'm stupid. Right!

Then this and the __component_adapts__ hack should be enough to make it 
work (still an unpleasant hack, that). With that I suspect I should even 
be able to steal the implementedBy and the adaptedBy from the annotation 
itself, which would mean I'd only need to spell it out there.

Thanks again!

Martijn


More information about the Zope3-dev mailing list