Question
I'm pretty new to querying in plone, and I was wondering what's an efficient way to return just images on the site using a catalog query, and searching by type. I don't want to have to restrict users to a given folder if I don't have to.
I tried:
catalog(object_provides="Products.ATContentTypes.interface.image.IATImage",
review_state='published',
sort_on='sortable_title')
but what it returned included pages, simpleblog pages and such (I assumed b/c those documents can have images in them, and therefore implement IATImage)
Much appreciated
Solution
To clarify, it's
catalog(portal_type="Image",
review_state='published',
sort_on='sortable_title')
Took me a few minutes of Googling before I realized you have to capitalize 'Image'. Also, it's just a single equals sign.
OTHER TIPS
Ok, found it. I rather than object_provides, I had to use portal_type=='image'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow