[Zope-CMF] CMF Tool gotchas

Dieter Maurer dieter at handshake.de
Thu Nov 20 14:04:21 EST 2003


Paul Winkler wrote at 2003-11-19 15:45 -0500:
 > I'm now working on my second CMF Tool, which I find to be a nice way to
 > add features to CMF. Things are working well.
 > But there are a couple of annoyances...
 > 
 > 1) I can't for the life of me figure out how to register my own icon for the tool.
 > In my __init__.py I have this:
 > 
 > def initialize(context):
 >     """Initialize the product."""
 >     utils.ToolInit(FooTool.FooTool.meta_type
 >                    , tools=(FooTool.FooTool,)
 >                    , product_name='FooTool' 
 >                    , icon='www/footool.gif', # why doesn't this work?
 >     ).initialize( context )

The sources of "Products.CMFCore.utils.ToolInit.initialize"
and "App.ProductContext.ProductContext.initializeClass"
explain why it does not work:

   "ToolInit.initialize" calls "ProductContext.initializeClass".
   This latter creates the icon. But, it does not use the
   provided "product_name" (if does not know it). Instead,
   it uses its own product name.

Remember "ToolInit"s "product_name" must be the name of the
product for which "initialize" is called.

-- 
Dieter



More information about the Zope-CMF mailing list