Modify

Opened 18 months ago

Closed 18 months ago

Last modified 16 months ago

#10975 closed defect (fixed)

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

Reported by: ngpitt@… Owned by: rjollos
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 18 months ago by rjollos

  • Owner changed from obs to rjollos
  • Status changed from new to assigned

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

comment:2 Changed 18 months ago by anonymous

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

comment:3 Changed 18 months ago by rjollos

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

comment:4 Changed 18 months ago by rjollos

Are you running Trac 0.12 or greater?

comment:5 Changed 18 months ago by rjollos

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

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

comment:6 follow-up: Changed 16 months ago by ivanelson

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 ; follow-up: Changed 16 months ago by 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.

comment:8 in reply to: ↑ 7 ; follow-up: Changed 16 months ago by 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?

comment:9 in reply to: ↑ 8 Changed 16 months ago by ivanelson

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

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.