Opened 12 years ago

Last modified 9 years ago

#10207 closed defect

Cannot update a ticket while changing child ticket to patent ticket(and vice versa) with a 'comment'. — at Version 2

Reported by: anonymous Owned by: Noah Kantrowitz
Priority: normal Component: MasterTicketsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

While changing child ticket to parent ticket in a ticket ,If we give some comment and submit both then there is no update in ticket and There is Integrity Error

IntegrityError: columns ticket, time, field are not unique

File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/web/main.py", line 511, in _dispatch_request
  dispatcher.dispatch(req)
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/web/main.py", line 237, in dispatch
  resp = chosen_handler.process_request(req)
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 169, in process_request
  return self._process_ticket_request(req)
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 541, in _process_ticket_request
  self._do_save(req, ticket, action)
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 1238, in _do_save
  cnum=internal_cnum):
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/ticket/model.py", line 360, in save_changes
  listener.ticket_changed(self, comment, author, old_values)
File "C:/SDWorkbenchServer/python/lib/site-packages/tracmastertickets-3.0.2-py2.7.egg/mastertickets/api.py", line 120, in ticket_changed
  links.save(author, comment, tkt.time_changed, db)
File "C:/SDWorkbenchServer/python/lib/site-packages/tracmastertickets-3.0.2-py2.7.egg/mastertickets/model.py", line 83, in save
  (n, when_ts, author, 'comment', '', '(In #%s) %s'%(self.tkt.id, comment)))
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/db/util.py", line 65, in execute
  return self.cursor.execute(sql_escape_percent(sql), args)
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/db/sqlite_backend.py", line 78, in execute
  result = PyFormatCursor.execute(self, *args)
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/db/sqlite_backend.py", line 56, in execute
  args or [])
File "C:/SDWorkbenchServer/python/lib/site-packages/trac-0.12.2-py2.7.egg/trac/db/sqlite_backend.py", line 48, in _rollback_on_error
  return function(self, *args, **kwargs)

Change History (3)

comment:1 Changed 12 years ago by anonymous

When we updating parent/child ticket with comment , the logic (for loop) was iterating 2 times to modify "parent field" and "child field" each in model.py . Each time while modifying if comment is given in field , it was updating that also. In first iteration the comment field was modified so in second iteration while changing it was throwing error. By making comment field to change only in one time, we can prevent the error. check out modified script(model.py) as attachment.

Changed 12 years ago by anonymous

Attachment: model.py added

Modified file

comment:2 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)
Note: See TracTickets for help on using tickets.