[Zope-dev] Question about using CatalogAware
Kevin Dangoor
kid@kendermedia.com
Wed, 4 Aug 1999 18:23:44 -0400
Greetings,
I've got a ZClass with ObjectManager and CatalogAware as base classes
(in that order). I'd like to make a DTML Method (in the ZClass) that
searches the catalog. Here's the method:
<dtml-call "REQUEST.set('topurl', PARENTS[0].absolute_url())">
<dtml-if "category == 'top'">
<dtml-call "REQUEST.set('searchfor', {'metatype' : 'KMArticle', 'top' :
'on', 'current' : 'on'})">
<dtml-else>
<dtml-call "REQUEST.set('searchfor', {'metatype' : 'KMArticle', 'category'
: category, 'current' : 'on'})">
</dtml-if>
<dtml-in "_[default_catalog](searchfor)" sort=score>
<dtml-if "release.isPast()">
<dtml-var list_item>
<dtml-else>
<dtml-if sequence-start>
<dtml-call "REQUEST.set('nofirst', 1)">
</dtml-if>
</dtml-if>
</dtml-in>
And I get the following error:
<STRONG>Error Type: AttributeError</STRONG><BR>
<STRONG>Error Value: no __call__ method defined</STRONG><BR>
From the traceback:
(Object: _[default_catalog](searchfor))
File <string>, line 0, in ?
AttributeError: (see above)
A test DTML Method showed me that default_catalog = 'Catalog'. I have a
ZCatalog called 'Catalog' in the Zope root. Since the ZClass is an Object
Manager, the Method is one level down and will have to acquire the catalog.
If I replace "_[default_catalog](searchfor)" with "Catalog(searchfor)", the
method works.
Any ideas what I'm doing wrong?
Thanks,
Kevin