[Zope-CMF] Re: [CMF 2.1] FSPageTemplate & Unicode
Martin Aspeli
optilude at gmx.net
Mon Jan 8 16:35:39 EST 2007
Dieter Maurer wrote:
> Martin Aspeli wrote at 2007-1-7 23:40 +0000:
>> ...
>> Why not do it a more Zope3 ish way:
>>
>> class ICMFTool(Interface):
>> """Marker for any CMF tool"""
>>
>> and then in the subclass of the local component registry:
>>
>> local_utility = ....
>> if ICMFTool.providedBy(local_utility):
>> local_utility = local_utility.__of__(context)
>>
>> or so.
>
> No need to invent a new marker interface for this.
>
> Objects ready to participate in context wrapping indicate this
> by the "__of__" method...
No, no need, but I'd argue good reasons.
- It's an explicit declaration of support
- It's a lot less magic
- It's prettier than getattr/hasattr
- If something else has an __of__() for whatever reason, we don't
catch it by accident.
- It may not be desirable to wrap everything that *could* be wrapped.
Martin
More information about the Zope-CMF
mailing list