def _resolve_alerts(self, cache): alerts = set() for (type_, id_) in cache.keys(): if type_ == Alert: alerts.add(id_) if not len(alerts): return for alert in Alert.all_by_ids(alerts, deleted=True): cache[(Alert, str(alert.id))] = role