[Zope] ZCatalog again

Nolan Darilek nolan_d@bigfoot.com
Mon, 06 Mar 2000 23:32:58 -0600


Ok, it appears that len() isn't what I want. I was under the
impression that searchResults() returned an object which functioned as a
list, but this wasn't right, apparently. Or maybe it was, *shrug*. :)
Here's my current code, which I've modified a bit for testing
purposes:

<dtml-var standard_html_header>
<dtml-calendar>
<dtml-call "setCalendar('valign','top')">                                                   
<dtml-let d="date.Date()"                                                                   
      hasdate="hasProperty(d)"                                                              
      dprop="getProperty(d)"
e="getCatalog().searchResults(meta_type='Event', event_date=date)">
<dtml-if e>
<dtml-let path="getCatalog().getpath(e[0].data_record_id_)">
<a href="&dtml-portal_url;&dtml-path;"><dtml-var
"date.dd()"></a>
</dtml-let>
<dtml-else>
<a href="&dtml-portal_url;/&dtml-date;"><dtml-var "date.dd()"></a>
</dtml-if>
<br>
<dtml-if "hasdate==1">                                                                      
  <dtml-var dprop>                                                                          
</dtml-if>                                                                                  
</dtml-let>                                                                                 
</dtml-calendar>
<dtml-var standard_html_footer>

This code generates links as it should. What I'm trying to do though
is, if an object of the Event class exists with an event_date which
equals the current rendered date, I'd like to link directly to it. I can
successfully search for the date using the PTK's search form, so I'm
fairly sure that my issues with the catalog are resolved.

So, what exactly is being returned by searchResults, and how can I
determine whether my search yielded anything, so that I can display a
link to the item?