def indexDocSubscriber(event): app = ISchoolToolApplication(None, None) if app is None: return obj = removeSecurityProxy(event.object) util = getUtility(IIntIds, context=app) obj_id = util.getId(obj) catalogs = ICatalogs(app) for entry in catalogs.values(): entry.catalog.index_doc(obj_id, obj)
def reindexDocSubscriber(event): app = ISchoolToolApplication(None, None) if app is None: return obj = removeSecurityProxy(event.object) util = queryUtility(IIntIds, context=app) if util is None: return obj_id = util.queryId(obj) if obj_id is None: return catalogs = ICatalogs(app) if obj is catalogs: return for entry in catalogs.values(): entry.catalog.index_doc(obj_id, obj)
def __call__(self): app = ISchoolToolApplication(None) catalogs = ICatalogs(app) key = self.key() version = self.getVersion() if key in catalogs: if catalogs[key].version == version: catalogs[key].expired = False else: del catalogs[key] if key not in catalogs: catalog = self.createCatalog() catalogs[key] = VersionedCatalog(catalog, version) # XXX: if setIndexes throw, delete the catalog and rethrow self.setIndexes(catalog)
def __call__(self): catalogs = ICatalogs(self.app) for entry in catalogs.values(): entry.expired = True
def __call__(self): catalogs = ICatalogs(self.app) for key in list(catalogs): if catalogs[key].expired: del catalogs[key]