Commits

Anonymous committed 2dc0207

[svn-9477] Ticket: make the `comment` parameter optional in `Ticket.save_changes`

Patch by Felix Schwarz on #9217.

Comments (0)

Files changed (2)

trac/ticket/model.py

 
         return self.id
 
-    def save_changes(self, author, comment, when=None, db=None, cnum=''):
+    def save_changes(self, author, comment=None, when=None, db=None, cnum=''):
         """
         Store ticket changes in the database. The ticket must already exist in
         the database.  Returns False if there were no changes to save, True

trac/ticket/tests/model.py

         self.assertEqual(ticket_id, ticket.id)
         self.assertEqual(ticket.resource.id, ticket_id)
 
+    def test_can_save_ticket_without_explicit_comment(self):
+        ticket = Ticket(self.env)
+        ticket.insert()
+        
+        ticket['summary'] = 'another summary'
+        ticket.save_changes('foo')
+        
+        changes = ticket.get_changelog()
+        comment_change = [c for c in changes if c[2] == 'comment'][0]
+        self.assertEqual('1', comment_change[3])
+        self.assertEqual('', comment_change[4])
+
+
     def test_ticket_default_values(self):
         """
         Verify that a ticket uses default values specified in the configuration