John Rouillard <rouilj+...@cs.umb.edu> added the comment:
Hi all: I took another look at this. I suggest replacing the current class with: class RandomIssueAction2(Action): def handle(self): """Redirect to a random open issue.""" issue = self.context['context'] # use issue._klass to get a list of ids, and not a list of instances issue_ids = issue._klass.filter(None, {'status': '1'}) random.seed() url = self.db.config.TRACKER_WEB + 'issue' + random.choice(issue_ids) raise Redirect(url) two changes, the addition of the random.seed() call and change {'status': 1} to {'status': '1'}. This works for my trackers. If I use the original {'status': 1} value I get no id's back. The addition of the seed makes the randomness return. Also note that this function will throw a traceback if there are no issues matching the reference criteria. Adding a try/catch or checking the size of the issue_ids list is left as an exercise for the reader 8-). -- rouilj _______________________________________________________ PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za> <http://psf.upfronthosting.co.za/roundup/meta/issue644> _______________________________________________________ _______________________________________________ Tracker-discuss mailing list Tracker-discuss@python.org https://mail.python.org/mailman/listinfo/tracker-discuss Code of Conduct: https://www.python.org/psf/codeofconduct/