diff options
Diffstat (limited to 'interfaces/web')
-rw-r--r-- | interfaces/web/templates/bug.html | 4 | ||||
-rw-r--r-- | interfaces/web/templates/list.html | 6 | ||||
-rw-r--r-- | interfaces/web/web.py | 30 |
3 files changed, 30 insertions, 10 deletions
diff --git a/interfaces/web/templates/bug.html b/interfaces/web/templates/bug.html index 4d15536..66993de 100644 --- a/interfaces/web/templates/bug.html +++ b/interfaces/web/templates/bug.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block page_title %} - Bug {{ bd.bug_shortname(bug) }} – {{ bug.summary|truncate(70) }} + Bug {{ bug.id.user() }} – {{ bug.summary|truncate(70) }} {% endblock %} {% block script %} @@ -157,4 +157,4 @@ </fieldset> </form> <p id="add-comment-link"><a href="" id="add-comment">+ Add a comment</a></p> -{% endblock %}
\ No newline at end of file +{% endblock %} diff --git a/interfaces/web/templates/list.html b/interfaces/web/templates/list.html index 1d409f7..83007d3 100644 --- a/interfaces/web/templates/list.html +++ b/interfaces/web/templates/list.html @@ -15,8 +15,8 @@ </tr> {% for bug in bugs %} <tr> - <td>{{ bd.bug_shortname(bug) }}</td> - <td><a href="/bug?id={{ bd.bug_shortname(bug)}}"> + <td>{{ bug.id.user() }}</td> + <td><a href="/bug?id={{ bug.id.user() }}"> {{ bug.summary|e|truncate(70) }}</a></td> <td>{{ bug.status }}</td> <td>{{ bug.target }}</td> @@ -24,4 +24,4 @@ </tr> {% endfor %} </table> -{% endblock %}
\ No newline at end of file +{% endblock %} 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'], |