[Zope] Portal catalog not always finding my content type

Maurits van Rees m.van.rees at zestsoftware.nl
Wed Nov 28 19:54:42 EST 2007


In some test code I add a custom content type called School.  Then I
check if it has been added to the portal catalog.  And I call a
function in a PAS plugin that searches for a School within the catalog
and does something with that.  This all works.  Tests pass.  I am

But in practice it somehow does not work.  In the portal_catalog
within the ZMI I can clearly see that a School is present in the
catalog.  But the code in my PAS plugin does not find it.  And in a
zopectl debug session I also cannot find it.

Here is some code I use.  Product is another custom content type.

  cat = getToolByName(self, 'portal_catalog')
  assert(len(cat()) > 5)
  assert(len(cat(portal_type='Product')) > 5)
  assert(len(cat(portal_type='School')) > 0)

The first two assertions pass, so the catalog seems to be functioning
properly.  The last assertion fails.

Can anyone think of a reason why this could happen?  Should I add some
more parameters to the catalog call?  Should I use searchResults
instead, or queryCatalog?

This is on Plone 3.0 btw, with Zope 2.10.5.  CMFPlone overwrites the
default CatalogTool from zope, so I thought about asking on a plone
list instead.  But since it *does* go correct in the tests I thought
it was probably not something Plone specific.  Feel free to direct me
to a different list though. :)


Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."

More information about the Zope mailing list