Merged bug.new_comment into bug.Bug.new_comment.
authorW. Trevor King <wking@drexel.edu>
Wed, 19 Nov 2008 13:05:17 +0000 (08:05 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 19 Nov 2008 13:05:17 +0000 (08:05 -0500)
Bugs-Everywhere-Web/beweb/controllers.py
becommands/comment.py
libbe/bug.py

index 6773aec87763ad98174dfe7a69cbf1c41a0de286..393f105fe78b405460b5c0b811c4817bad75510d 100644 (file)
@@ -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))
index b2dad4e31fcc020b85a133fc1a403f420862a5ff..ec932624ced778d0194eb3d796e6eb51bee9044e 100644 (file)
@@ -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()
index 4cb53c271b629d1795a2f778fe7589e936cda57a..a297b1a5ff37fefd393c8128254cc548ff760a8a 100644 (file)
@@ -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: