aboutsummaryrefslogtreecommitdiffstats
path: root/web.py
diff options
context:
space:
mode:
authorSteve Losh <steve@stevelosh.com>2009-06-25 17:54:18 -0400
committerSteve Losh <steve@stevelosh.com>2009-06-25 17:54:18 -0400
commitcc14e7e4ca90f007117a595b34e45dec2c805d77 (patch)
treecfec303da8434bec5f4e314b1c8dbcca4d822b02 /web.py
parent01d2ad07456974c3b4d4539a7b49f4af0916795b (diff)
downloadbugseverywhere-cc14e7e4ca90f007117a595b34e45dec2c805d77.tar.gz
Fix the EMPTY problem.
Diffstat (limited to 'web.py')
-rw-r--r--web.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/web.py b/web.py
index b9df64f..bd7a89b 100644
--- a/web.py
+++ b/web.py
@@ -1,8 +1,10 @@
import cherrypy
-from libbe import bugdir
+from libbe import bugdir, settings_object
from jinja2 import Environment, FileSystemLoader
from datetime import datetime
+EMPTY = settings_object.EMPTY
+
def datetimeformat(value, format='%B %d, %Y at %I:%M %p'):
"""Takes a timestamp and revormats it into a human-readable string."""
return datetime.fromtimestamp(value).strftime(format)
@@ -21,11 +23,11 @@ class WebInterface:
def get_common_information(self):
"""Returns a dict of common information that most pages will need."""
possible_assignees = list(set(
- [unicode(bug.assigned) for bug in self.bd if bug.assigned != 'None']))
+ [unicode(bug.assigned) for bug in self.bd if bug.assigned != EMPTY]))
possible_assignees.sort(key=unicode.lower)
possible_targets = list(set(
- [unicode(bug.target) for bug in self.bd if bug.target != 'None']))
+ [unicode(bug.target) for bug in self.bd if bug.target != EMPTY]))
possible_targets.sort(key=unicode.lower)
possible_statuses = [u'open', u'assigned', u'test', u'unconfirmed',
@@ -45,7 +47,7 @@ class WebInterface:
bugs = [bug for bug in self.bd if bug.status in status]
if assignee != '':
- assignee = None if assignee == 'None' else assignee
+ assignee = EMPTY if assignee == 'None' else assignee
bugs = [bug for bug in bugs if bug.assigned == assignee]
if target != '':
@@ -71,9 +73,11 @@ class WebInterface:
label = 'All Closed Bugs'
if assignee != '':
- label += ' Currently Unassigned' if assignee == 'None' else ' Assigned to %s' % (assignee,)
+ label += ' Currently Unassigned' if assignee == 'None' \
+ else ' Assigned to %s' % (assignee,)
if target != '':
- label += ' Currently Unschdeuled' if target == 'None' else ' Scheduled for %s' % (target,)
+ label += ' Currently Unschdeuled' if target == 'None' \
+ else ' Scheduled for %s' % (target,)
template = self.env.get_template('list.html')
bugs = self.filter_bugs(status, assignee, target)
@@ -98,6 +102,8 @@ class WebInterface:
template = self.env.get_template('bug.html')
common_info = self.get_common_information()
return template.render(bug=bug, bd=self.bd,
+ assignee='' if bug.assigned == EMPTY else bug.assigned,
+ target='' if bug.target == EMPTY else bug.target,
assignees=common_info['possible_assignees'],
targets=common_info['possible_targets'],
statuses=common_info['possible_statuses'],