import turbogears
from turbogears import controllers, expose, validate, redirect, identity
-from libbe.bugdir import (tree_root, cmp_severity, new_bug, new_comment,
- NoRootEntry)
-from libbe import names
+from libbe.bugdir import tree_root, new_bug, new_comment, NoRootEntry
from config import projects
from prest import PrestHandler, provide_action
bug_tree = project_tree(project)
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)
+ bugs.sort()
return {"project_id" : project,
"project_name" : projects[project][0],
"bugs" : bugs,
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Create a new bug"""
from libbe import cmdutil, names
-from libbe.bug import new_bug
__desc__ = __doc__
def execute(args):
if len(args) != 1:
raise cmdutil.UserError("Please supply a summary message")
dir = cmdutil.bug_tree()
- bug = new_bug(dir)
+ bug = dir.new_bug()
bug.summary = args[0]
bug.save()
bugs = (dir.list())
comments.sort(cmp_time)
return comments
-def new_bug(dir, uuid=None):
- bug = dir.new_bug(uuid)
- bug.creator = bug.rcs.get_user_id()
- bug.severity = "minor"
- bug.status = "open"
- bug.time = time.time()
- return bug
-
def new_comment(bug, body=None):
comm = bug.new_comment()
comm.From = comm.rcs.get_user_id()
self.rcs.mkdir(path)
bug = Bug(self.bugs_path, None, self.rcs, self)
bug.uuid = uuid
+ bug.creator = self.rcs.get_user_id()
+ bug.severity = "minor"
+ bug.status = "open"
+ bug.time = time.time()
return bug
class InvalidValue(ValueError):