aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.be/bugs/c592a1e8-f2c8-4dfb-8550-955123073947/values2
-rw-r--r--beweb/beweb/controllers.py41
-rw-r--r--beweb/beweb/templates/edit_bug.kid4
3 files changed, 44 insertions, 3 deletions
diff --git a/.be/bugs/c592a1e8-f2c8-4dfb-8550-955123073947/values b/.be/bugs/c592a1e8-f2c8-4dfb-8550-955123073947/values
index 7f0ab44..e854f0e 100644
--- a/.be/bugs/c592a1e8-f2c8-4dfb-8550-955123073947/values
+++ b/.be/bugs/c592a1e8-f2c8-4dfb-8550-955123073947/values
@@ -15,7 +15,7 @@ severity=minor
-status=open
+status=closed
diff --git a/beweb/beweb/controllers.py b/beweb/beweb/controllers.py
index 6fc9277..5b458d8 100644
--- a/beweb/beweb/controllers.py
+++ b/beweb/beweb/controllers.py
@@ -1,7 +1,7 @@
import turbogears
from turbogears import controllers
import cherrypy
-from libbe.bugdir import tree_root, cmp_severity, new_bug
+from libbe.bugdir import tree_root, cmp_severity, new_bug, new_comment
from libbe import names
from config import projects
from prest import PrestHandler, provide_action
@@ -19,7 +19,41 @@ def expose_resource(html=None):
return func
return exposer
+def comment_url(project, bug, comment):
+ return turbogears.url("/project/%s/bug/%s/comment/%s" %
+ (project, bug, comment))
+
+class Comment(PrestHandler):
+ @provide_action("action", "New comment")
+ def new_comment(self, comment_data, comment, *args, **kwargs):
+ bug_tree = project_tree(comment_data['project'])
+ bug = bug_tree.get_bug(comment_data['bug'])
+ comment = new_comment(bug, "")
+ comment.save()
+ raise cherrypy.HTTPRedirect(comment_url(comment=comment.uuid,
+ **comment_data))
+
+ @provide_action("action", "Update")
+ def update(self, comment_data, comment, comment_body, *args, **kwargs):
+ comment.body = comment_body
+ comment.save()
+ raise cherrypy.HTTPRedirect(bug_url(comment_data['project'],
+ comment_data['bug']))
+
+ def instantiate(self, project, bug, comment):
+ bug_tree = project_tree(project)
+ bug = bug_tree.get_bug(bug)
+ return bug.get_comment(comment)
+
+ def dispatch(self, comment_data, comment, *args, **kwargs):
+ return self.edit_comment(comment_data['project'], comment)
+
+ @turbogears.expose(html="beweb.templates.edit_comment")
+ def edit_comment(self, project, comment):
+ return {"comment": comment, "project_id": project}
+
class Bug(PrestHandler):
+ comment = Comment()
@turbogears.expose(html="beweb.templates.edit_bug")
def index(self, project, bug):
return {"bug": bug, "project_id": project}
@@ -66,6 +100,11 @@ class Bug(PrestHandler):
def instantiate(self, project, bug):
return project_tree(project).get_bug(bug)
+ @provide_action("action", "New comment")
+ def new_comment(self, bug_data, bug, *args, **kwargs):
+ return self.comment.new_comment(bug_data, comment=None, *args,
+ **kwargs)
+
def project_url(project_id=None):
project_url = "/project/"
diff --git a/beweb/beweb/templates/edit_bug.kid b/beweb/beweb/templates/edit_bug.kid
index b328d82..49dbe52 100644
--- a/beweb/beweb/templates/edit_bug.kid
+++ b/beweb/beweb/templates/edit_bug.kid
@@ -2,7 +2,7 @@
<?python
from libbe.bugdir import severity_levels
from libbe.utility import time_to_str
-from beweb.controllers import bug_list_url
+from beweb.controllers import bug_list_url, comment_url
def select_among(name, options, default):
output = ['<select name="%s">' % name]
for option in options:
@@ -36,9 +36,11 @@ def select_among(name, options, default):
<tr><td>Date</td><td>${time_to_str(comment.date)}</td></tr>
</table>
<pre>${comment.body}</pre>
+ <a href="${comment_url(project_id, bug.uuid, comment.uuid)}">Edit</a>
</insetbox>
</div>
<p><input type="submit" name="action" value="Update"/></p>
+<p><input type="submit" name="action" value="New comment"/></p>
</form>
<a href="${bug_list_url(project_id)}">Bug List</a>
</body>