[z3-five] Re: Adapted component instantiation?

Petri Savolainen petri.savolainen at iki.fi
Fri Dec 17 15:08:16 MET 2004


Uhh please ignore that - wasn't thinking. Obviously adapters are for 
adapting objects dynamically as the functionality provided by a given 
adapter is needed.

Petri Savolainen wrote:
> When adapting a zope2 component using some zope3/Five adapters, how does 
> one construct them? Do I need to override the __new__ method? Ie. 
> something like:
> 
> class SimpleAtContent(BaseContent):
> 
>    meta_type = portal_type ="SimpleContent"
> 
>    def __new__(cls, *args, **kwargs):
>       obj = BaseContent(*args, **kwargs)
>       adapted = IMyInterface(obj)
>       return adapted
> 
> Thanks,
> 
>    Petri
> 



More information about the z3-five mailing list