[Zope] ZCatalog Confusion
James W. Howe
jwh@allencreek.com
Wed, 26 Jan 2000 13:35:42 -0500
I'm starting to experiment with ZCatalogs as a way to organize and access
some content on my web site. I've created a ZCatalog and had it index some
key attributes of some ZClass instances that I have created. Currently my
catalog has 4 entries. Elsewhere I have some code which is attempting to
extract ZClasses with specific attributes. In my particular case my
ZClasses are news articles and each article has a 'section' attribute which
indicates where the article should be viewed. I have a DTMLMethod which
looks like this:
<dtml-in "ArticleIndex(meta_type='Article', section='Restaurant Review',
publicationDate=_['publicationDate'])">
<dtml-return "ArticleIndex.getpath(data_record_id_)">
</dtml-in>
This method is implemented in an "issue" object which, among other things,
defines a property called "publicationDate". There is only one 'Article'
which has a section of 'Restaurant Review'. As such, my assumption was
that this method would return the url of the article with a section
property of 'Restaurant Review'. Unfortunately this isn't the case. Upon
further debugging, I find that this loop is iterating over *all* items in
the catalog rather than finding the one entry with the proper section
value. My obvious question is why? From what I've read, my statement
should only return a collection of objects who have a meta_type of Article,
a section value of 'Restaurant Review' and a publication date equal to the
publication date of my issue. Can someone explain why my request to the
catalog is returning objects which don't meet all the requirements?
Thanks.
James W. Howe mailto:jwh@allencreek.com
Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103