@turbogears.expose()
def index(self):
raise cherrypy.HTTPRedirect(project_url())
-
- @turbogears.expose()
- def default(self, *args, **kwargs):
- if len(args) == 1:
- return self.bugs(args[0], **kwargs)
- elif len(args) == 2:
- return self.bug(*args, **kwargs)
- else:
- return repr(args)
-
-
- @turbogears.expose(html="beweb.templates.bugs")
- def bugs(self, project_id, sort_by=None, show_closed=False):
- if show_closed == "False":
- show_closed = False
- bug_tree = project_tree(project_id)
- bugs = list(bug_tree.list())
- if sort_by is None:
- def cmp_date(bug1, bug2):
- return -cmp(bug1.time, bug2.time)
- bugs.sort(cmp_date)
- bugs.sort(cmp_severity)
- return {"project_id" : project_id,
- "project_name" : projects[project_id][0],
- "bugs" : bugs,
- "show_closed" : show_closed,
- }
-
- @turbogears.expose(html="beweb.templates.edit_bug")
- def bug(self, project_id, bug_uuid, action=None, status=None,
- severity=None, summary=None):
- bug_tree = project_tree(project_id)
- if action == "New bug":
- bug = bug_tree.new_bug()
- bug.creator = names.creator()
- bug.severity = "minor"
- bug.status = "open"
- bug.save()
- raise cherrypy.HTTPRedirect(turbogears.url("/%s/%s/" % (project_id, bug.uuid)))
- else:
- bug = bug_tree.get_bug(bug_uuid)
- if action == "Update":
- bug.status = status
- bug.severity = severity
- bug.summary = summary
- bug.save()
- raise cherrypy.HTTPRedirect(turbogears.url("/%s/" % project_id))
-
- return {"bug": bug, "project_id": project_id, "new":True}
<?python
from libbe.bugdir import severity_levels
from libbe.utility import time_to_str
+from beweb.controllers import bug_list_url
def select_among(name, options, default):
output = ['<select name="%s">' % name]
for option in options:
</div>
<p><input type="submit" name="action" value="Update"/></p>
</form>
-<a href="/${project_id}/">Bug List</a>
+<a href="${bug_list_url(project_id)}">Bug List</a>
</body>
</html>