[Zope-CMF] [dev] tools as utilities

yuppie y.2012 at wcm-solutions.de
Tue Sep 4 06:59:27 UTC 2012


Hi!


In CMF 2.3 (beta) all core tools can be looked up using getUtility for 
mandatory tools or queryUtility for optional tools. That's a big step 
forward, but there are still some places where we depend on tool 
characteristics:


1.) Bootstrapping:
==================

Importing .zexp files or upgrading old sites some tools are used before 
they are registered as utilities.

Currently there are fallbacks in place that use the old tool lookup. I 
guess some events need to be disabled for .zexp imports.


2.) Site root lookup:
=====================

In several tools we still assume aq_parent(aq_inner(self)) is the 
portal. Or other code uses the tool as context object, expecting root 
and request in its acquisition chain.

These should be identified and replaced by 
getUtility(IURLTool).getPortalObject() or other suitable code.


3.) Action providers:
=====================

Action providers are still registered and looked up by ID.

Most Actions were moved to the Actions Tool. Only two 2 special Action 
providers are left: Types Tool and Workflow Tool.

I have no plans to convert that registry to something based on utility 
lookup. I guess it would be better to create specialized 'object' and 
'workflow' categories that are linked to the Types Tool and the Workflow 
Tool. But that's a different story.


4.) Skins:
==========

The Skins Tool lookup is based on the getSkinsFolderName method.

If there are no objections, I'll replace that by 
queryUtility(ISkinsTool) without providing any backward compatibility 
code for getSkinsFolderName.


Cheers,

	Yuppie



More information about the Zope-CMF mailing list