[Zope-CMF] Re: Small CMFCatalogAware refactoring

Tres Seaver tseaver at palladion.com
Mon Sep 12 08:18:35 EDT 2005

Hash: SHA1

Jean-Marc Orliaguet wrote:

> Julien fixed a bug. Only poorly designed software implements hardcoded
> references to paths ('portal_catalog'). And he needed it to implement a
> separate catalog for portlets. So let's move on....

'portal_catalog' is not a hard-coded reference to a path;  it is a
"well-known name" for a service, which in the original design is a
singleton.  As a parallel, think of the interface or the name used to
find an adapter in the Zope3 component architecture;  code which uses
them is equally "hard-wired".

The point of the 'getToolByName' indirection was to mark such uses as
intended service lookups.  Code which blindly uses direct attribute
lookup, e.g. 'context.portal_catalog', *is* buggy.

Julien's refactoring is not a bugfix, but a refactoring, intended to
allow the possibility of using more than one catalog.  I would actually
prefer to see it spelled as an adapter lookup, in the CMF 2.0 world, so
that we don't implement yet another component architecture.  The
refactoring as written is fine for the 1.5 branch, however.

- --
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the Zope-CMF mailing list