[Python-checkins] r88912 - in tracker/instances/python-dev: extensions/pydevutils.py html/page.html
ezio.melotti
python-checkins at python.org
Tue Oct 18 15:22:36 CEST 2011
Author: ezio.melotti
Date: Tue Oct 18 15:22:36 2011
New Revision: 88912
Log:
Add a link to return a random open issue.
Modified:
tracker/instances/python-dev/extensions/pydevutils.py
tracker/instances/python-dev/html/page.html
Modified: tracker/instances/python-dev/extensions/pydevutils.py
==============================================================================
--- tracker/instances/python-dev/extensions/pydevutils.py (original)
+++ tracker/instances/python-dev/extensions/pydevutils.py Tue Oct 18 15:22:36 2011
@@ -1,3 +1,8 @@
+import random
+from roundup.cgi.actions import Action
+from roundup.cgi.exceptions import Redirect
+
+
def is_history_ok(request):
user = request.client.userid
db = request.client.db
@@ -35,8 +40,20 @@
return last_entry[4][1], last_action
return None, None
+
+class RandomIssueAction(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})
+ url = self.db.config.TRACKER_WEB + 'issue' + random.choice(issue_ids)
+ raise Redirect(url)
+
+
def init(instance):
instance.registerUtil('is_history_ok', is_history_ok)
instance.registerUtil('is_coordinator', is_coordinator)
instance.registerUtil('issueid_and_action_from_class',
issueid_and_action_from_class)
+ instance.registerAction('random', RandomIssueAction)
Modified: tracker/instances/python-dev/html/page.html
==============================================================================
--- tracker/instances/python-dev/html/page.html (original)
+++ tracker/instances/python-dev/html/page.html Tue Oct 18 15:22:36 2011
@@ -10,7 +10,7 @@
<link media="screen" href="http://python.org/styles/largestyles.css" type="text/css" rel="alternate stylesheet" title="large text" />
<link media="screen" href="http://python.org/styles/defaultfonts.css" type="text/css" rel="alternate stylesheet" title="default fonts" />
<link rel="stylesheet" type="text/css" href="@@file/style.css" />
-<link rel="search" type="application/opensearchdescription+xml"
+<link rel="search" type="application/opensearchdescription+xml"
href="@@file/osd.xml"
title="Python bug tracker search" />
<meta http-equiv="Content-Type"
@@ -31,7 +31,7 @@
<!-- Logo -->
<h1 id="logoheader">
<a accesskey="1" href="." id="logolink">
- <img src="http://python.org/images/python-logo.gif"
+ <img src="http://python.org/images/python-logo.gif"
alt="homepage" border="0" id="logo" /></a>
</h1>
@@ -84,6 +84,7 @@
<a href="issue?@template=item" i18n:translate="">Create New</a>
</li>
<li><a href="issue?@template=search&status=1" i18n:translate="">Search</a></li>
+ <li><a href="issue?@action=random">Random Issue</a></li>
<li>
<form method="post" action="#">
<input type="submit" class="form-small" value="Show issue:" i18n:attributes="value"/>
@@ -276,7 +277,7 @@
<div id="credits">
<a href="http://www.python.org/about/website">Website maintained by the Python community</a><br />
-<a href="http://www.upfrontsystems.co.za/" title="issue tracker hosting provided by Upfront Systems, South Africa">hosting by Upfront Systems</a> /
+<a href="http://www.upfrontsystems.co.za/" title="issue tracker hosting provided by Upfront Systems, South Africa">hosting by Upfront Systems</a> /
<a href="http://roundup.sf.net" title="Powered by the Roundup Issue Tracker">powered by Roundup</a>
</div> <!-- credits -->
Copyright © 1990-2011, <a href="http://python.org/psf">Python Software Foundation</a><br />
More information about the Python-checkins
mailing list