[Zope] ZCatalog and dtml-calendar

Nolan Darilek nolan_d@bigfoot.com
Mon, 06 Mar 2000 22:39:29 -0600


I'm trying to create a dtml-calendar which searches a Z catalog using
a custom field on one of my Z classes. I've tested the search by hand,
and it seems to work. I seem to be having a few issues with DTML,
though. Here is my code:

<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="SiteIndex.getpath(e[0].data_record_id_)">
<a href="&dtml-portal_url;&dtml-path;"><dtml-var
"date.dd()"></a>
</dtml-let>
<dtml-else>
<dtml-var "date.dd()">
</dtml-if>
<br>
<dtml-if "hasdate==1">                                                                      
  <dtml-var dprop>                                                                          
</dtml-if>                                                                                  
</dtml-let>                                                                                 
</dtml-calendar>
<dtml-var standard_html_footer>

The problem line is <dtml-if "e">. What I was intending to do is
perform the code if the search result actually returned something, but
this doesn't seem to be happening. What I'd like to do is:

<dtml-if "len(e) > 0)">

But, len() doesn't seem to be defined in whichever namespace the code
is being run in. I tried:

<dtml-call "global len">

before the dtml-if, but this errored out as well. Am I completely
misunderstanding the problem which I'm having?

Thanks.