id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
10194	Cannot update a ticket using trac.ticket.model.save_changes with both a 'comment' and a 'when' field.	farialima	rjollos	This was found in the TicketImportPlugin, see #10188, and took me some time to debug. The following piece of code (given an `env` environment):\r\n\r\n{{{\r\n#!python\r\nfrom trac.ticket.web_ui import Ticket \r\nfrom datetime import datetime \r\nfrom trac.util.datefmt import utc \r\nticket = Ticket(env) \r\nticket['summary'] = 'The summary' \r\nticket.insert() \r\nticket['blockedby'] = str(ticket.id) \r\nticket.save_changes('someone', comment='Some comments',\r\n                    when=datetime.now(utc)) \r\n}}}\r\n\r\nwill work if the MasterTicketsPlugin is not installed, but will fail if it is installed, with the following error:\r\n{{{\r\nticket.save_changes('someone', 'Some comments',\r\n                    when=datetime.now(utc))\r\n  File "/Users/francois/ticketimportplugin/0.11/env2.5/lib/python2.5/site-packages/Trac-0.12-py2.5.egg/trac/ticket/model.py", line 353, in save_changes\r\n    listener.ticket_changed(self, comment, author, old_values)\r\n  File "build/bdist.macosx-10.7-x86_64/egg/mastertickets/api.py", line 111, in ticket_changed\r\n    links.save(author, comment, tkt.time_changed, db)\r\n  File "build/bdist.macosx-10.7-x86_64/egg/mastertickets/model.py", line 76, in save\r\n    (n, when_ts, author, 'comment', '', '(In #%s) %s'%(self.tkt.id, comment)))\r\n  File "/Users/francois/ticketimportplugin/0.11/env2.5/lib/python2.5/site-packages/Trac-0.12-py2.5.egg/trac/db/util.py", line 65, in execute\r\n    return self.cursor.execute(sql_escape_percent(sql), args)\r\n  File "/Users/francois/ticketimportplugin/0.11/env2.5/lib/python2.5/site-packages/Trac-0.12-py2.5.egg/trac/db/sqlite_backend.py", line 79, in execute\r\n    result = PyFormatCursor.execute(self, *args)\r\n  File "/Users/francois/ticketimportplugin/0.11/env2.5/lib/python2.5/site-packages/Trac-0.12-py2.5.egg/trac/db/sqlite_backend.py", line 57, in execute\r\n    args or [])\r\n  File "/Users/francois/ticketimportplugin/0.11/env2.5/lib/python2.5/site-packages/Trac-0.12-py2.5.egg/trac/db/sqlite_backend.py", line 48, in _rollbac\\\r\nk_on_error\r\n    return function(self, *args, **kwargs)\r\nIntegrityError: columns ticket, time, field are not unique\r\n}}}\r\n\r\nSee browser:ticketimportplugin/0.11/talm_importer/test.py@11805#L460	defect	reopened	normal	MasterTicketsPlugin	normal			jun66j5, falkb	0.12
