John Rouillard <rouilj+...@cs.umb.edu> added the comment: Hi Berker:
In message <1510257288.61.0.213398074469.issue...@psf.upfronthosting.co.za>, Berker Peksag writes: >Hi John, do you know a workaround to make the random issue >extension work again? I pulled the source for the bugs.python.org tracker and took a look. The function I got to work better in my demo tracker was: import random from roundup.cgi.actions import Action from roundup.cgi.exceptions import Redirect class RandomIssueAction(Action): def handle(self): """Redirect to a random open issue.""" issue = self.db.getclass('issue') issue_ids = issue.filter(None, {'status': 1}) random.seed() url = self.db.config.TRACKER_WEB + 'issue' + random.choice(issue_ids) raise Redirect(url) def init(instance): instance.registerAction('random', RandomIssueAction) I changed: the way I got the handle to issues from the db the way the list of id's in my tracker instance I was getting tracebacks otherwise. Since you do get redirected to a page on bugs.python.org you obviously aren't getting traceback so this new function may not work. Originally triggering the random action I saw a lot of repeats. My thought was that the random function wasn't so random. The new 1.5.1+ (what will be 1.6) roundup uses more random data than 1.4.20. Addition of nonces to protect against csrf etc. consumes random data. So I added random.seed(). This seemed to increase the randomness of the function. You may want to try adding random.seed() to your existing function and see if that helps. Even after seeding, I still saw duplicates, but there were only 20 issues to choose from. In your case you have 6000+ issues to select from duplicates by chance are reduced. _______________________________________________________ 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/