Added ability to create bugs to web UI
authorAaron Bentley <abentley@panoramicfeedback.com>
Fri, 2 Dec 2005 14:49:34 +0000 (14:49 +0000)
committerAaron Bentley <abentley@panoramicfeedback.com>
Fri, 2 Dec 2005 14:49:34 +0000 (14:49 +0000)
.be/bugs/b1bc6f39-8166-46c5-a724-4c4a3e1e7d74/values [new file with mode: 0644]
beweb/beweb/controllers.py
beweb/beweb/templates/bugs.kid

diff --git a/.be/bugs/b1bc6f39-8166-46c5-a724-4c4a3e1e7d74/values b/.be/bugs/b1bc6f39-8166-46c5-a724-4c4a3e1e7d74/values
new file mode 100644 (file)
index 0000000..c767d0f
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+
+creator=abentley
+
+
+
+
+
+
+severity=minor
+
+
+
+
+
+
+status=open
+
+
+
+
+
+
+summary=Comments do not appear in web UI
+
+
+
index b8e28547f2ad70687124220033ad19145c7d0d66..cdcf1e725f66b4315f7a0db62b1ca35d9a31b93a 100644 (file)
@@ -1,6 +1,8 @@
 import turbogears
 from turbogears import controllers
+import cherrypy
 from libbe.bugdir import tree_root, cmp_severity
+from libbe import names
 from config import projects
 
 def project_tree(project):
@@ -45,10 +47,19 @@ class Root(controllers.Root):
     def bug(self, project_id, bug_uuid, action=None, status=None, 
             severity=None, summary=None):
         bug_tree = project_tree(project_id)
-        bug = bug_tree.get_bug(bug_uuid)
+        if action == "New bug":
+            bug = bug_tree.new_bug()
+            bug.creator = names.creator()
+            bug.severity = "minor"
+            bug.status = "open"
+            bug.save()
+            raise cherrypy.HTTPRedirect(turbogears.url("/%s/%s/" % (project_id, bug.uuid))) 
+        else:
+            bug = bug_tree.get_bug(bug_uuid)
         if action == "Update":
             bug.status = status
             bug.severity = severity
             bug.summary = summary
             bug.save()
-        return {"bug": bug, "project_id": project_id}
+            
+        return {"bug": bug, "project_id": project_id, "new":True}
index ef89b0f21ffe64152a6b2695ed0b8fd500b19e22..c5014c8b8bc7a6b66d53b81551277db3c534f08e 100644 (file)
@@ -24,5 +24,8 @@ def row_class(bug):
 </table>
 <a href="/">Project list</a>
 <a href="${'/%s/?show_closed=%s' % (project_id, str(not show_closed))}">Toggle closed</a>
+<form action="/$project_id/new/" method="post">
+<input type="submit" name="action" value="New bug"/>
+</form>
 </body>
 </html>