aboutsummaryrefslogtreecommitdiffstats
path: root/interfaces/web/web.py
diff options
context:
space:
mode:
Diffstat (limited to 'interfaces/web/web.py')
-rw-r--r--interfaces/web/web.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/interfaces/web/web.py b/interfaces/web/web.py
index d6f2fdd..e80f676 100644
--- a/interfaces/web/web.py
+++ b/interfaces/web/web.py
@@ -1,5 +1,8 @@
import cherrypy
+from libbe import storage
from libbe import bugdir
+from libbe.command.depend import get_blocks
+from libbe.command.util import bug_comment_from_user_id
from libbe.storage.util import settings_object
from jinja2 import Environment, FileSystemLoader
from datetime import datetime
@@ -17,8 +20,12 @@ class WebInterface:
def __init__(self, bug_root, template_root):
"""Initialize the bug repository for this web interface."""
self.bug_root = bug_root
- self.bd = bugdir.BugDir(root=self.bug_root)
- self.repository_name = self.bd.root.split('/')[-1]
+ store = storage.get_storage(self.bug_root)
+ store.connect()
+ version = store.storage_version()
+ print version
+ self.bd = bugdir.BugDir(store, from_storage=True)
+ self.repository_name = self.bug_root.split('/')[-1]
self.env = Environment(loader=FileSystemLoader(template_root))
self.env.filters['datetimeformat'] = datetimeformat
@@ -29,7 +36,9 @@ class WebInterface:
possible_assignees.sort(key=unicode.lower)
possible_targets = list(set(
- [unicode(bug.target) for bug in self.bd if bug.target != EMPTY]))
+ [unicode(bug.summary.rstrip("\n")) for bug in self.bd \
+ if bug.severity == u"target"]))
+
possible_targets.sort(key=unicode.lower)
possible_statuses = [u'open', u'assigned', u'test', u'unconfirmed',
@@ -99,13 +108,24 @@ class WebInterface:
self.bd.load_all_bugs()
- bug = self.bd.bug_from_shortname(id)
+ bug, comment = bug_comment_from_user_id(self.bd, id)
template = self.env.get_template('bug.html')
common_info = self.get_common_information()
+
+ # Determine which targets a bug has.
+ # First, is this bug blocking any other bugs?
+ targets = ''
+ blocks = get_blocks(self.bd, bug)
+ for targetbug in blocks:
+ # Are any of those blocked bugs targets?
+ blocker = self.bd.bug_from_uuid(targetbug.uuid)
+ if blocker.severity == "target":
+ targets += "%s " % blocker.summary
+
return template.render(bug=bug, bd=self.bd,
assignee='' if bug.assigned == EMPTY else bug.assigned,
- target='' if bug.target == EMPTY else bug.target,
+ target=targets,
assignees=common_info['possible_assignees'],
targets=common_info['possible_targets'],
statuses=common_info['possible_statuses'],