Johannes Schwenk wrote:
Hi All,
I have the following code in one of my content types:
def get_vocab(self):
pc = getToolByName(self, 'portal_catalog')
query = {}
query['path'] = '/'.join(self.getPhysicalPath()) + '/vocabulary'
query['depth'] = 1
query['object_provides'] = ICategorizerVocabTerm.__identifier__
brains = pc.searchResults(**query)
dl = DisplayList()
for term in brains:
dl.add(term['id'], term['Title'])
return dl
This should return all objects under ./vocabulary providing the
ICategorizerVocabTerm interface. But I *always* get the "vocabulary" object
too, because it provides the interface also. It does not make any difference,
whether I set "depth" to 1, 0 or whatever... Strange! I read in Martins Book,
that depth=1 should leed to the wanted behaviour, beeing "all *sub*items
under ./vocabulary that provide ICategorizerVocabTerm, *not* the item
provided as path" !
The depth argument is being ignored. It is a parameter of the path index:
query['path'] = {
'query': '/'.join(self.getPhysicalPath()) + '/vocabulary' }
'depth': 1,
}
Ricardo
--
Ricardo Alves <[email protected]>
Eurotux <http://www.eurotux.com>
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers