Modify

Opened 3 years ago

Closed 22 months ago

#9008 closed defect (fixed)

indexerror when referencing a new ticket

Reported by: kenny Owned by: 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 (2)

issue1.png (3.3 KB) - added by kenny 3 years ago.
issue2.png (37.3 KB) - added by kenny 3 years ago.

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by kenny

Changed 3 years ago by kenny

comment:1 Changed 3 years ago 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

comment:2 Changed 3 years ago by rjollos

  • Status changed from new to assigned

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

comment:3 Changed 3 years ago by rjollos

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

comment:4 Changed 3 years ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

(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].

comment:5 Changed 22 months ago by ejucovy

  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

comment:6 Changed 22 months ago by ejucovy

  • Owner changed from rjollos to ejucovy
  • Status changed from reopened to new

comment:7 Changed 22 months ago by ejucovy

  • Resolution set to fixed
  • Status changed from new to closed

(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 Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.