Modify

Opened 13 years ago

Closed 12 years ago

#9008 closed defect (fixed)

indexerror when referencing a new ticket

Reported by: Kenny Bohle 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 Bohle 13 years ago.
issue2.png (37.3 KB) - added by Kenny Bohle 13 years ago.

Download all attachments as: .zip

Change History (9)

Changed 13 years ago by Kenny Bohle

Attachment: issue1.png added

Changed 13 years ago by Kenny Bohle

Attachment: issue2.png added

comment:1 Changed 13 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 13 years ago by Ryan J Ollos

Status: newassigned

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

comment:3 Changed 13 years ago by Ryan J Ollos

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

comment:4 Changed 13 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(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 12 years ago by ejucovy

Resolution: fixed
Status: closedreopened

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 12 years ago by ejucovy

Owner: changed from Ryan J Ollos to ejucovy
Status: reopenednew

comment:7 Changed 12 years ago by ejucovy

Resolution: fixed
Status: newclosed

(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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain ejucovy.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.