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
@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))
# 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__
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()
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):
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: