Вопрос

Is there a way to know if an object is Archetypes-based or Dexterity-based using only the brains resulting from a catalog search?

Это было полезно?

Решение

A Dexterity item usually has its meta_type set to 'Dexterity Item' or 'Dexterity Container'. That is available in the catalog metadata.

Другие советы

I don't think that this information is indexed, but it can be easily retreived by getting the FTI. The lookup can be cached when handling large result sets.

I think something like this should work:

from plone.dexterity.interfaces import IDexterityFTI
from zope.component.hooks import getSite
from Products.CMFCore.utils import getToolByName

def is_dexterity(brain):
    ttool = getToolByName(getSite(), 'portal_types')
    fti = ttol.get(brain.portal_type)
    return IDexterityFTI.providedBy(fti)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top