[Python-checkins] r70242 - in tracker/instances/python-dev: extensions/search_id.py html/page.html

martin.v.loewis python-checkins at python.org
Sun Mar 8 14:09:31 CET 2009


Author: martin.v.loewis
Date: Sun Mar  8 14:09:31 2009
New Revision: 70242

Log:
Issue #123: Support entering issue IDs in the search box.


Added:
   tracker/instances/python-dev/extensions/search_id.py   (contents, props changed)
Modified:
   tracker/instances/python-dev/html/page.html

Added: tracker/instances/python-dev/extensions/search_id.py
==============================================================================
--- (empty file)
+++ tracker/instances/python-dev/extensions/search_id.py	Sun Mar  8 14:09:31 2009
@@ -0,0 +1,15 @@
+from roundup.cgi.actions import Action
+from roundup.cgi import exceptions
+
+class SearchIDAction(Action):
+    def handle(self):
+        request = self.context['request']
+        split = request.search_text.split()
+        if len(split) == 1:
+            id = split[0]
+            if id.isdigit():
+                if self.db.hasnode('issue', id):
+                    raise exceptions.Redirect('issue'+id)
+
+def init(instance):
+    instance.registerAction('searchid', SearchIDAction)

Modified: tracker/instances/python-dev/html/page.html
==============================================================================
--- tracker/instances/python-dev/html/page.html	(original)
+++ tracker/instances/python-dev/html/page.html	Sun Mar  8 14:09:31 2009
@@ -41,6 +41,7 @@
        <input type="hidden" name="@sort" value="-activity" />
        <input type="hidden" name="@group" value="priority" />
        <input type="hidden" name="@filter" value="status"/>
+       <input type="hidden" name="@action" value="searchid"/>
        <input type="hidden" name="status" tal:attributes="value status_notresolved"/>
        <input class="input-text" id="search-text" name="@search_text" size="10" />
 <input type="submit" id="submit" value="search in open issues" name="submit"


More information about the Python-checkins mailing list