def _get_texts(object, default): if IPhoto.providedBy(object): return default adapter = queryAdapter(object, ITextIndexData) if adapter is None: if not IContent.providedBy(object) or ICalendarLayer.providedBy(object) or ICalendarCategory.providedBy(object): return default adapter = FlexibleTextIndexData(object) texts = adapter() if not texts: return default return texts
def evolve(site): """ Add the IPhoto marker interface to profile and news item photos. """ catalog = find_catalog(site) search = ICatalogSearch(site) count, docids, resolver = search( interfaces={'operator': 'or', 'query': [INewsItem, IProfile]}) for docid in docids: doc = resolver(docid) photo = doc.get('photo') if photo is not None and not IPhoto.providedBy(photo): alsoProvides(photo, IPhoto) catalog.reindex_doc(photo.docid, photo)
def _get_texts(object, default): if IPhoto.providedBy(object): return default adapter = queryAdapter(object, ITextIndexData) if adapter is None: if (not IContent.providedBy(object) or ICalendarLayer.providedBy(object) or ICalendarCategory.providedBy(object)): return default adapter = FlexibleTextIndexData(object) texts = adapter() if not texts: return default return texts