[Zope-CMF] [dev] tools as utilities

Tres Seaver tseaver at palladion.com
Tue Sep 4 13:35:57 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/04/2012 02:59 AM, yuppie wrote:
> 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.

Upgrades should always ensure that the registry is correct first.


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

I'd rather not add any cruft to support .zexp imports, which have seemed
fundamentally broken to me for a long time.


> 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.

Maybe we could add a convenience API for that?


> 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.

+1.  Thanks for the analysis.



- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBGA70ACgkQ+gerLs4ltQ4bJgCgyDFo01qjfe0jixBKY3m5DKd/
1JMAnAnNv0vn0DCuqqPZcqpp3+qtVbHw
=BRht
-----END PGP SIGNATURE-----



More information about the Zope-CMF mailing list