[Framework-Team] Re: suggestion for central place to import tool interfaces from

Raphael Ritz r.ritz at biologie.hu-berlin.de
Mon Mar 12 09:00:16 UTC 2007

Martin Aspeli schrieb:
> [..]
> The good news is that most CMF tools are in 
> Products.CMFCore.interfaces; the other ones are more specific, like 
> some of the i18n tools. I think we ought to think closely about the 
> interfaces in PlonePAS, though.
And while we are at this: I think Andy has a point here, nevertheless.
I also feel somewhat uncomfortable when seeing things like

  tool = getToolByName(context, 'some_tool')

being replaced with

  tool = getToolByInterfaceName(context, 

This is not only because it's more typing and it looks more ugly
but mainly because I'm afraid we will have to explain to people
over and over again what to import from where.

For one, it's simply not true that most interfaces live in CMFCore
(simply compare a CMFDefault site and an OOTB Plone site) so
we will have to educate people "yes, while this interface is from
CMFCore, this other one is from here and this one is from there"
which we didn't need to do before.

Second, people may find it confusing when looking at the
membership tool let's say. They may realize that there are
definitions in CMFCore, CMFDefault and CMFPlone (the
implementations, not the interface definition) so looking
up the membership tool they might try

  tool = getToolByInterfaceName(context, 


  tool = getToolByInterfaceName(context, 

would be the right thing.

With other words, it may look like you where looking for the tool
as defined in CMFCore but you'll get the one from CMFPlone (or thatever
else might be registered at the local site). For people that don't have
the big picture (yet)  - and we are talking about TTW coding here -
this might turn out to be confusing.

Frankley speaking, I never really understood why getToolByInterfaceName
needs the full dotted path to the interface definition anyway. Couldn't
this utility just do what it proposes to do, namely look up by *name*
(which for me would be just 'IMembershipTool', without the path;
maybe it does and this is a non-issue then forget about this)?


> Martin
> _______________________________________________
> Framework-Team mailing list
> Framework-Team at lists.plone.org
> http://lists.plone.org/mailman/listinfo/framework-team

More information about the Framework-Team mailing list