[Zope] Need ZCatalog help
Michel Pelletier
michel@digicool.com
Fri, 10 Sep 1999 09:56:22 -0400
John Goerzen wrote:
>
> Here I am talking to myself again :-)
>
> I have two more questions to go along with the below.
>
> I have made a ZCatalog up near the top of my tree named
> EventsCatalog. I have a method named getEventsByDate that now usses
> this. This method works fine if invoked directly, but if not, it
> claims it can't find EventsCatalog -- even if both the method and the
> caller are clearly below EventsCatalog in the tree, thus acquisition
> should step in.
>
> Here's the code:
>
> <dtml-with "_(myEventList=[])">
> <dtml-in "EventsCatalog.searchResults({'when' :
> [startDate, endDate], 'when_usage' : 'range:min:max'})">
> <dtml-call "myEventList.append(EventsCatalog.resolve_url('/' +
> EventsCatalog.getpath(data_record_id_),
> REQUEST=REQUEST))"></dtml-comment>
> </dtml-in>
> <dtml-return myEventList>
> </dtml-with>
>
> Now, it is aborting at searchResults.
Do you have a traceback?
>
> Secondly, the search string *may* be working, but I don't understand
> the syntax. What do the colons and the curly braces signify? Why is
> "_usage" significant? What exactly does 'range:min:max' indicate?
'when' is your search term. If a search term ends in '_usage' then the
usage term is used to control something in particular about the index it
refers to. In this case, it is telling the 'when' index that it's
search term is a min/max range search. Because it needs two values (a
min and a max) you must pass a 2 item list as the value for the 'when'
term.
You can call catalog several ways:
<dtml-in Catalog>
This will call the catalog, passing REQUEST in to satisfy any search
terms. Or you can pass a mapping:
<dtml-in "Catalog.searchResults({'term':'value, ...})">
or you can use keyword arguments:
<dtml-in "Catalog.searchResults(term=value, ...)">
-Michel