aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugs-Everywhere-Web/beweb/controllers.py4
-rw-r--r--becommands/comment.py3
-rw-r--r--libbe/bug.py12
3 files changed, 7 insertions, 12 deletions
diff --git a/Bugs-Everywhere-Web/beweb/controllers.py b/Bugs-Everywhere-Web/beweb/controllers.py
index 6773aec..393f105 100644
--- a/Bugs-Everywhere-Web/beweb/controllers.py
+++ b/Bugs-Everywhere-Web/beweb/controllers.py
@@ -4,7 +4,7 @@ import cherrypy
import turbogears
from turbogears import controllers, expose, validate, redirect, identity
-from libbe.bugdir import tree_root, new_bug, new_comment, NoRootEntry
+from libbe.bugdir import tree_root, new_comment, NoRootEntry
from config import projects
from prest import PrestHandler, provide_action
@@ -103,7 +103,7 @@ class Bug(PrestHandler):
@identity.require( identity.has_permission("editbugs"))
@provide_action("action", "New bug")
def new_bug(self, bug_data, bug, **kwargs):
- bug = new_bug(project_tree(bug_data['project']))
+ bug = project_tree(bug_data['project']).new_bug()
bug.creator = identity.current.user.userId
bug.save()
raise cherrypy.HTTPRedirect(bug_url(bug_data['project'], bug.uuid))
diff --git a/becommands/comment.py b/becommands/comment.py
index b2dad4e..ec93262 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -16,7 +16,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Add a comment to a bug"""
from libbe import cmdutil, utility
-from libbe.bug import new_comment
import os
__desc__ = __doc__
@@ -64,7 +63,7 @@ def execute(args):
if not body.endswith('\n'):
body+='\n'
- comment = new_comment(bug, body)
+ comment = bug.new_comment(body)
if parent_comment is not None:
comment.in_reply_to = parent_comment.uuid
comment.save()
diff --git a/libbe/bug.py b/libbe/bug.py
index 4cb53c2..a297b1a 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -186,12 +186,15 @@ class Bug(object):
path = self.get_path()
self.rcs.recursive_remove(path)
- def new_comment(self):
+ def new_comment(self, body=None):
if not os.path.exists(self.get_path("comments")):
self.rcs.mkdir(self.get_path("comments"))
comm = Comment(None, self)
comm.uuid = names.uuid()
comm.rcs = self.rcs
+ comm.From = self.rcs.get_user_id()
+ comm.time = time.time()
+ comm.body = body
return comm
def get_comment(self, uuid):
@@ -216,13 +219,6 @@ class Bug(object):
comments.sort(cmp_time)
return comments
-def new_comment(bug, body=None):
- comm = bug.new_comment()
- comm.From = comm.rcs.get_user_id()
- comm.time = time.time()
- comm.body = body
- return comm
-
def add_headers(obj, map, names):
map_names = {}
for name in names: