[Zope-CMF] Re: Small CMFCatalogAware refactoring
Sidnei da Silva
sidnei at enfoldsystems.com
Mon Sep 12 09:49:11 EDT 2005
On Mon, Sep 12, 2005 at 09:10:02AM -0400, Tres Seaver wrote:
| Those won't be named utilities; they will be adapters, with
| "tool-centric" interfaces. For code which currently spells the lookup::
|
| catalog = getToolByName(some_context, 'portal_catalog')
|
| I prefer::
|
| catalog = ICatalog(some_context)
Which, in a backwards-compatible way could be implemented as:
def getToolByName(context, name):
iface = lookupToolInterface(name)
return iface(context)
And probably issuing a deprecation warning, though I'm not sure it's
really worth deprecating that.
--
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
More information about the Zope-CMF
mailing list