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 get_textrepr(object, default): adapter = queryAdapter(object, ITextIndexData) if adapter is not None: text = adapter() return text elif (IContent.providedBy(object)): fmt = "%s %s" tr = fmt % ( getattr(object, 'title', ''), getattr(object, 'description', ''), ) return tr return default
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(context): catalog = find_catalog(context) index = catalog['texts'] for docid in index.index._docweight.keys(): try: path = catalog.document_map.address_for_docid(docid) context = find_resource(context, path) if (ICalendarLayer.providedBy(context) or ICalendarCategory.providedBy(context) or not IContent.providedBy(context)): index.unindex_doc(docid) if hasattr(context, '_p_deactivate'): context._p_deactivate() except KeyError: # Work around some bad data in the db--some calendar categories # got added with '/' characters in their ids. Skip them for now # until we can figure out what to do with them. print "Bad path in catalog: ", path
def evolve(context): catalog = find_catalog(context) index = catalog['texts'] for docid in index.index._docweight.keys(): try: path = catalog.document_map.address_for_docid(docid) context = find_model(context, path) if (ICalendarLayer.providedBy(context) or ICalendarCategory.providedBy(context) or not IContent.providedBy(context)): index.unindex_doc(docid) if hasattr(context, '_p_deactivate'): context._p_deactivate() except KeyError: # Work around some bad data in the db--some calendar categories # got added with '/' characters in their ids. Skip them for now # until we can figure out what to do with them. print "Bad path in catalog: ", path