Ticket #9008 (closed defect: fixed)

Opened 2 years ago

Last modified 7 months ago

indexerror when referencing a new ticket

Reported by: kenny Assigned to: ejucovy
Priority: normal Component: TracBacksPlugin
Severity: normal Keywords: indexerror
Cc: Trac Release: 0.11

Description

The plugin will create an internal error when a new ticket without a changelog is referenced. See the screenshots below for more information.

Attachments

issue1.png (3.3 kB) - added by kenny on 07/21/11 11:21:51.
issue2.png (37.3 kB) - added by kenny on 07/21/11 11:22:31.

Change History

07/21/11 11:21:51 changed by kenny

  • attachment issue1.png added.

07/21/11 11:22:31 changed by kenny

  • attachment issue2.png added.

07/21/11 16:14:36 changed by anonymous

Got the same issue:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 170, in process_request
    return self._process_newticket_request(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 398, in _process_newticket_request
    self._do_create(req, ticket) # (redirected if successful)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 1193, in _do_create
    ticket.insert()
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/ticket/model.py", line 246, in insert
    listener.ticket_created(self)
  File "/usr/local/lib/python2.7/dist-packages/Tracbacks-0.1-py2.7.egg/tracbacks/tracbacks.py", line 66, in ticket_created
    ticket.values.get('reporter'), None)
  File "/usr/local/lib/python2.7/dist-packages/Tracbacks-0.1-py2.7.egg/tracbacks/tracbacks.py", line 100, in ticket_changed
    cnum_lastcomment = int(cnum_lastchange[-1])
ValueError: invalid literal for int() with base 10: 'assigned'

and

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/ticket/web_ui.py", line 1238, in _do_save
    cnum=internal_cnum):
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/Tracbacks-0.1-py2.7.egg/tracbacks/tracbacks.py", line 98, in ticket_changed
    lastchange = change_log[-1]
IndexError: list index out of range

07/21/11 18:21:32 changed by rjollos

  • status changed from new to assigned.

I'll try to take a look this weekend. Thanks for reporting.

07/22/11 01:10:26 changed by rjollos

Defect confirmed. It looks like it was introduced with [9658].

07/22/11 01:26:32 changed by rjollos

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [10485]) Fixes #9008: If the referenced ticket didn't have a change log (at least 1 ticket comment), the ticket's cnum would not be correctly set to 1 and an exception would result. This defect appears to have been introduced in [9658].

10/18/12 17:03:48 changed by ejucovy

  • status changed from closed to reopened.
  • resolution deleted.

This is still failing, but with a different error now: AttributeError: 'int' object has no attribute 'rsplit'

In the event that the changelog is empty, cnum_thischange needs to be set to the string "1", not the integer 1.

10/18/12 17:04:16 changed by ejucovy

  • owner changed from rjollos to ejucovy.
  • status changed from reopened to new.

10/18/12 17:04:37 changed by ejucovy

  • status changed from new to closed.
  • resolution set to fixed.

(In [12197]) close #9008 -- In the event that the changelog is empty, cnum_thischange needs to be set to the string "1", not the integer 1


Add/Change #9008 (indexerror when referencing a new ticket)




Change Properties
Action