Modify

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#10975 closed defect (fixed)

KeyError: 'type' is generated on the reports page if no types exist

Reported by: ngpitt@… Owned by: Ryan J Ollos
Priority: normal Component: BlackMagicTicketTweaksPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

blackmagic.py line 153 assumes that the key types exists in dict data["fields"]. This is not the case if no types are specified in the given trac environment.

This is easily reproducible by clicking "Custom Query" under "View Tickets" when no types have been configured.

This error can be fixed by prefacing the for loop on line 153 with:

if "type" in data["fields"]:

Attachments (0)

Change History (9)

comment:1 Changed 12 years ago by Ryan J Ollos

Owner: changed from obs to Ryan J Ollos
Status: newassigned

Sounds easy enough to fix. If it's as straightforward as you suggest, I should have a fix committed shortly ;)

comment:2 Changed 12 years ago by anonymous

Oops! Include the 1st line after the for loop as well. It also includes data["fields"]["types"].

comment:3 Changed 12 years ago by Ryan J Ollos

Thanks. I'll push a patch in the morning.

comment:4 Changed 12 years ago by Ryan J Ollos

Are you running Trac 0.12 or greater?

comment:5 Changed 12 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(In [12824]) Fixes #10975: Fixed KeyError when no ticket types are defined. Thanks to ngpitt@… for the patch.

comment:6 Changed 11 years ago by Ivanelson Nunes

This error has been corrected in this ticket! Or I am wrong? I downloaded and installed the current version, but also restarted Apache. But the error continues:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 224, in dispatch
    self._post_process_request(req, *resp)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/web/main.
py", line 338, in _post_process_request
    resp = f.post_process_request(req, *resp)
  File "/usr/local/lib/python2.7/dist-packages/BlackMagicTicketTweaks-0.12r1-py2
.7.egg/blackmagic/blackmagic.py", line 99, in post_process_request
    data["numrows"]-=self.blockedTickets;
KeyError: 'numrows'

My Trac1.0.

Thanks

comment:7 in reply to:  6 ; Changed 11 years ago by Ryan J Ollos

Replying to ivanelson:

This error has been corrected in this ticket! Or I am wrong?

The issue reported in comment:description is different than the issue you are reporting. It should be fairly easy to fix though. Let's make a separate ticket for the issue you are reporting.

comment:8 in reply to:  7 ; Changed 11 years ago by Ivanelson Nunes

Replying to rjollos:

Replying to ivanelson:

This error has been corrected in this ticket! Or I am wrong?

The issue reported in comment:description is different than the issue you are reporting. It should be fairly easy to fix though. Let's make a separate ticket for the issue you are reporting.

You will open the Ticket? Or I can create the Ticket?

comment:9 in reply to:  8 Changed 11 years ago by Ivanelson Nunes

Replying to ivanelson:

Replying to rjollos:

Replying to ivanelson:

This error has been corrected in this ticket! Or I am wrong?

The issue reported in comment:description is different than the issue you are reporting. It should be fairly easy to fix though. Let's make a separate ticket for the issue you are reporting.

You will open the Ticket? Or I can create the Ticket?

Ticket opened: https://trac-hacks.org/ticket/11140

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.