[Zope-CMF] Re: ICMFTool marker interface

Philipp von Weitershausen philipp at weitershausen.de
Mon Apr 19 12:25:28 EDT 2004


Christian Heimes wrote:
> I would like to add a marker interface for CMF tools to CMFCore, 
> CMFDefault, CMFActionIcons and EventListenerTool.

This proposal lacks a problem description and a detailled discussion of 
why you think this would fix the problem, including practical use-cases.

Anyway, considering the idea itself, I would suggest adopting a pattern 
we're using in Zope3. Instead of deriving IActionIcons from ICMFTool and 
thus requiring every CMF tool to implement ICMFTool, directly or 
indirectly, I would suggest the following setup::

   from Interface.IInterface import IInterface

   # note that we derive from *I*Interface
   class ICMFTool(IInterface):
       """Meta-interface that is implemented by interfaces that
       describe CMF Tools."""

Then, the interface for a tool, such as CMFActionIcons tool would look 
like::

   from Interface import Interface

   class IActionIconsTool(Interface):
       """Interface for a tool providing icons for actions."""

       ...

   # IActionIconsTool is an interface describing a CMF Tool
   from Interface.Implements import implements
   implements(IActionIconsTool, ICMFTool)

A simple algorithm (that would need to be adapted to old-style 
interfaces) can be found at: 
http://cvs.zope.org/Zope3/src/zope/app/interface/__init__.py?rev=HEAD&content-type=text/vnd.viewcvs-markup 
(search for queryType).

Likewise, one could start having content interfaces implement 
IContentType, also a marker interface derived from IInterface. We 
already do that in Zope3 and it would make transition even smoother. 
Then again, frameworks like Archetype completely ignore interfaces and 
rather use their own descriptors. A shame.

Philipp




More information about the Zope-CMF mailing list