[Zope] Catalog search from Python Script

Timothy Wilson wilson@visi.com
Sun, 14 Oct 2001 17:27:31 -0500 (CDT)


Hi everyone,

I'm working on something that should be very easy, but I must be missing
something.

I've whipped up a little ZClass that will be used to keep track of our
school lunch menus. The class has the following properties:

menu_date (date)
school (string)
special_event (string)
breakfast_menu (lines)
lunch_menu (lines)

I created a ZCatalog to allow me to pull out each day's menu and display it
on the school's homepage. I'm using a separate Catalog for this with the
following indexes and metadata:

Indexes
=======
menu_date
school

Metadata
========
menu_date
school
special_event
breakfast_menu
lunch_menu

I created a very simple Python Script that should query the catalog and
return a reference that that day's menu. Here's the code (inspired by
examples from the Zope Book):

## Script (Python) "queryMenu"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Get today's lunch menu
##
"""
Retrieve today's lunch menu from the Catalog
"""
return context.Catalog(
        {'menu_date' : context.ZopeTime(),
        }
)

The problem is that nothing gets returned even when I know that there's an
instance with menu_date set for 10/14/2001 (no we don't serve lunch on
Sundays). Any ideas?

-Tim

--
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com