[Zope3-dev] Re: Question on new feature
Philipp von Weitershausen
philipp at weitershausen.de
Fri Feb 4 10:04:04 EST 2005
Gintautas Miliauskas wrote:
> Hello,
>
>
>>What's the status of __used_for__? Is adapts the preferred semantic, or
>>is it different from __used_for__?
>
>
> I might be wrong, but I think that __used_for__ is not validated or
> taken into account anywhere into the code, it's just a comment.
> adapts(), on the other hand, is an explicit statement and allows you to
> write cool and concise things like "provideAdapter(MyAdapter)" (I'm not
> sure if such adapters can be registered in ZCML without interface
> declarations, but that is probable).
You're correct on everything:
* __used_for__ was nothing than a comment spelled out in Python code.
* adapts() works like implements() in the way that it puts a marker on
the class that has a significant meaning in the component architecture
machinery
* that allows you to just say provideAdapter(MyAdapter) and even in
ZCML, you don't have to specify the for="" anymore.
Philipp
More information about the Zope3-dev
mailing list