referencing objects returned by z-catalog
Hi, I'm having difficulty with the syntax needed to access the objects in the results object returned by a z-catalog. I'm using the dtml-calendar tag to give a calendar display of objects, which have a date field. I have 3 objects of a product called calendar_event, which has a text property notes, and string field event_date. I have a z-catalog called ce_catalog, which indexes these, but without the notes field in the metadata - it's a large text field, so I don't want to bring it back in every object referred to in a search result. I try to call it with the following dtml: <dtml-calendar> <dtml-let year="date.year()" month="date.month()" day="date.day()" key="'%.4d-%.2d-%.2d' % (year,month,day)"> <dtml-in "ce_catalog({'event_date':key})"> <dtml-var expr="_['sequence-item'].notes"> </dtml-in> </dtml-let> </dtml-calendar> but I get an attribute error - error value: notes. if I replace the sequence-item dtml-var tag with <dtml-var expr="_['sequence-key']"> this gives me the object ids. and if I just call the object directly by id, e.g. <dtml-var expr="ce_1.notes">, this gives me the value I'm after. what am I doing wrong? Ben Avery
On Mon, Jul 01, 2002 at 05:55:23PM +0100, Ben Avery wrote:
... but I get an attribute error - error value: notes.
if I replace the sequence-item dtml-var tag with <dtml-var expr="_['sequence-key']"> this gives me the object ids. and if I just call the object directly by id, e.g. <dtml-var expr="ce_1.notes">, this gives me the value I'm after.
what am I doing wrong?
The ZCatalog doesn't return your real objects, but special objects instead. you can access your real objects with a <dtml-with getObject> inside your loop over the search results, IIRC. another solution is to add notes as a metadata in your catalog, which will make them available directly hth Jerome Alet
instead of: <dtml-var expr="_['sequence-item'].notes"> try the following: <dtml-with getObject> <dtml-var notes> </dtml-with> /wolfie -- http://www.t0.or.at Ben Avery wrote:
Hi,
I'm having difficulty with the syntax needed to access the objects in the results object returned by a z-catalog.
I'm using the dtml-calendar tag to give a calendar display of objects, which have a date field. I have 3 objects of a product called calendar_event, which has a text property notes, and string field event_date. I have a z-catalog called ce_catalog, which indexes these, but without the notes field in the metadata - it's a large text field, so I don't want to bring it back in every object referred to in a search result.
I try to call it with the following dtml:
<dtml-calendar> <dtml-let year="date.year()" month="date.month()" day="date.day()" key="'%.4d-%.2d-%.2d' % (year,month,day)"> <dtml-in "ce_catalog({'event_date':key})">
<dtml-var expr="_['sequence-item'].notes">
</dtml-in> </dtml-let> </dtml-calendar>
participants (3)
-
Ben Avery -
Jerome Alet -
wchr