def determineCandidates(self): """Find all distinct BugTask targets with their cached names. Returns a list of (target, set_of_cached_names) pairs, where target is a tuple of IDs from the columns in target_columns. """ store = ISlaveStore(BugTask) candidate_set = store.find(target_columns).config(distinct=True) candidates = defaultdict(set) for candidate in candidate_set: candidates[candidate[:-1]].add(candidate[-1]) return list(candidates.iteritems())