[Zope] Need ZCatalog help

John Goerzen jgoerzen@complete.org
10 Sep 1999 12:45:46 -0500


Michel Pelletier <michel@digicool.com> writes:

> Do you have a traceback?

Yes.  Let me give you a more complete context.

The method is called by ACLUG/events/index.html with this code:

<dtml-in "eventsByDate(this(), _=_, startDate=ZopeTime(), REQUEST=REQUEST)" sort=when>
  <dtml-var View_HTML>
  <P>
</dtml-in>

eventsByDateis the thing that is having trouble.  It returns Event
objects, which have View_HTML method.  (This code worked fine before
eventsByDate used ZCatalog).

The full code for eventsByDate is:

<dtml-comment>
  This function returns all the events within a specified
  date range.

  Arguments:

  startDate
    optional, defines the beginning date.

  endDate
    optional, defines the ending date.

  oneDay
    optional, shortcut, sets both startDate and endDate to the
    same value.

  useIds
    returns Ids instead of objects.

</dtml-comment>

<dtml-if oneDay>
  <dtml-call "REQUEST.set('startDate',
   _.DateTime(oneDay.year(),oneDay.month(),oneDay.day(),0,0,0,oneDay.timezone()))">
  <dtml-call "REQUEST.set('endDate', oneDay.latestTime())">
</dtml-if>

<dtml-unless startDate>
   <dtml-call "REQUEST.set('startDate', _.DateTime('1980/01/01'))">
</dtml-unless>

<dtml-unless endDate>
   <dtml-call "REQUEST.set('endDate', _.DateTime('2030/01/01'))">
</dtml-unless>

<dtml-with "_(myEventList=[])">
<dtml-comment>, mstartDate=_['startDate'], mendDate=_['endDate'])"></dtml-comment>

  <dtml-in "EventsCatalog.searchResults({'when' :
   [startDate, endDate], 'when_usage' : 'range:min:max'})">

  <dtml-if useIds>
    <dtml-call "myEventList.append(id)">
  <dtml-else>
<dtml-comment>    <dtml-call "myEventList.append(EventsCatalog.resolve_url('/' + EventsCatalog.getpath(data_record_id_), REQUEST=REQUEST))"></dtml-comment>
  </dtml-if>
</dtml-in>
<dtml-return myEventList>
</dtml-with>

The error message is:


<TD WIDTH="90%">
  <H2>Zope Error</H2>
  <P>Zope has encountered an error while publishing this resource.
  </P>
  
  <P>
  <STRONG>Error Type: NameError</STRONG><BR>
  <STRONG>Error Value: EventsCatalog</STRONG><BR> 
  </P>
 
  <HR NOSHADE>
 
  <P>Troubleshooting Suggestions</P>

  <UL>
    <LI>This resource may be trying to reference a
  nonexistent object or variable <STRONG>EventsCatalog</STRONG>.</LI>
    <LI>The URL may be incorrect.</LI>
  <LI>The parameters passed to this resource may be incorrect.</LI>
  <LI>A resource that this resource relies on may be encountering an error.</LI>
  </UL>

  <P>For more detailed information about the error, please
  refer to the HTML source for this page.
  </P>

  <P>If the error persists please contact the site maintainer.
  Thank you for your patience.
  </P>
</TD></TR>
</TABLE>


<p><a href="http://www.zope.org/Credits"><img src="http://www.complete.org:8080/p_/ZopeButton" width="115" height="50" border="0" alt="Powered by Zope"></a></p>
</BODY></HTML>
<!--
Traceback (innermost last):
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 179, in publish
  File /usr/lib/zope/lib/python/Zope/__init__.py, line 201, in zpublisher_exception_hook
    (Object: ElementWithAttributes)
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 165, in publish
  File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: index_html)
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object
    (Object: index_html)
  File /usr/lib/zope/lib/python/OFS/DTMLMethod.py, line 145, in __call__
    (Object: index_html)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__
    (Object: index_html)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 321, in eval
    (Object: _['index.html'])
  File &lt;string&gt;, line 0, in ?
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 156, in careful_getitem
  File /usr/lib/zope/lib/python/OFS/DTMLDocument.py, line 162, in __call__
    (Object: index.html)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__
    (Object: index.html)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 633, in renderwob
    (Object: eventsByDate(this(), _=_, startDate=ZopeTime(), REQUEST=REQUEST))
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 321, in eval
    (Object: eventsByDate(this(), _=_, startDate=ZopeTime(), REQUEST=REQUEST))
  File &lt;string&gt;, line 0, in ?
  File /usr/lib/zope/lib/python/OFS/DTMLMethod.py, line 145, in __call__
    (Object: eventsByDate)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 502, in __call__
    (Object: eventsByDate)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_With.py, line 148, in render
    (Object: _(myEventList=[]))
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 633, in renderwob
    (Object: EventsCatalog.searchResults({'when' :
   [startDate, endDate], 'when_usage' : 'range:min:max'}))
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 321, in eval
    (Object: EventsCatalog.searchResults({'when' :
   [startDate, endDate], 'when_usage' : 'range:min:max'}))
  File &lt;string&gt;, line 0, in ?
NameError: (see above)

-->