[Zope] ZCatalog of method output

Rik Hoekstra rik.hoekstra@inghist.nl
Sat, 1 Apr 2000 21:22:48 +0200


-----Original Message-----
From: Loren Stafford <lstafford@icompression.com>
To: zope@zope.org <zope@zope.org>
Date: vrijdag 31 maart 2000 23:03
Subject: [Zope] ZCatalog of method output


>I read you could define a ZClass instance's method as a field-index of a
>ZCatalog; but it's not working for me.
>
>The DTML method dept_code is simply:
>
>  <dtml-return "_.string.split(jobcode,'-')[0]">
>
>When I call the method directly it returns a single character, the first
>character of the jobcode.
>
>The method dept_code is defined as a field-index of the ZCatalog JobsCat.
>But when I access JobsCat thus:
>
> <dtml-in "JobsCat(meta_type='Job Opening', sort_on='dept_code')">
>   <li>
>   <a href="<dtml-var "JobsCat.getpath(data_record_id_)">">
>            (<dtml-var dept_code>) <dtml-var jobcode>: <dtml-var title></a>
> </dtml-in>
>
>the items are not sorted, and dept_code is null.
>
>Can anyone see what I'm doing wrong?


As I understood it (but I may be wrong, cause I never understood why), a
DTML method in a field index is only usable if it doesn't contain any
variables anything, that is only if it contains only static values (like
<dtml-return "'1,2,3,4'"> for example. If you want something executed as a
property - use either an External Method or a Python Method.
It was something about the Catalog not being able to feed arguments to a
method, but I'd be glad if someone could explain this...

Rik