aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces/web
diff options
context:
space:
mode:
authorChris Ball <cjb@laptop.org>2010-09-06 18:14:04 -0400
committerChris Ball <cjb@laptop.org>2010-09-06 19:22:27 -0400
commit488df80b7076fc027c23bc0e4713268755f9dfa9 (patch)
tree3161f604c4179cbbb077e600aa5546c35846592e /interfaces/web
parent3099e08c62410f16e99393ba09b36e79c0fa53ab (diff)
downloadbugseverywhere-488df80b7076fc027c23bc0e4713268755f9dfa9.tar.gz
cfbe: API: implement search-by-target
Diffstat (limited to 'interfaces/web')
-rw-r--r--interfaces/web/web.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/interfaces/web/web.py b/interfaces/web/web.py
index d910420..f99f625 100644
--- a/interfaces/web/web.py
+++ b/interfaces/web/web.py
@@ -6,7 +6,8 @@ import cherrypy
from libbe import storage
from libbe import bugdir
-from libbe.command.depend import get_blocks
+from libbe.command.depend import get_blocked_by, get_blocks
+from libbe.command.target import bug_from_target_summary, bug_target
from libbe.command.util import bug_comment_from_user_id
from libbe.storage.util import settings_object
@@ -67,8 +68,16 @@ class WebInterface:
if target != '':
target = None if target == 'None' else target
- bugs = [bug for bug in bugs if bug.target == target]
-
+ if target == None:
+ # Return all bugs that don't block any targets.
+ return [bug for bug in bugs if not bug_target(self.bd, bug)]
+ else:
+ # Return all bugs that block the supplied target.
+ targetbug = bug_from_target_summary(self.bd, target)
+ if targetbug == None:
+ return []
+ bugs = [bug for bug in get_blocked_by(self.bd, targetbug) if
+ bug.status not in ('closed', 'fixed', 'wontfix')]
return bugs