Modify

Opened 8 years ago

Closed 8 years ago

#13069 closed defect (fixed)

TicketsBoardPlubin: Save-Error KeyError: u'new'

Reported by: thomas.feustel@… Owned by: jpsave
Priority: normal Component: TicketsBoardPlugin
Severity: normal Keywords: KeyError
Cc: Trac Release: 1.0

Description

Hello,

we are using the ticketsboard-plugin. We are able to view the board, move the ticket over the board. But if we click the save-button, the issue "KeyError: u'new'" will appear. (The Issue will appear with each step.)

I was trying out TicketsBoard 1.2.2 and 1.2.3 - both with same issue.

Any Idee, how to fix it?

Error-Report from agilo:

How to Reproduce

While doing a POST operation on /ticketsboard, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'08780a5f99a9ded47d043e9b',
 'ticketsboard_changes': u'572:status=new',
 'ticketsboard_submit': u'Save Changes',
 'user': u''}

User agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3)

System Information

Trac 1.0.1
Agilo 1.3.15
Babel 0.9.6
Docutils 0.8.1
Genshi 0.6 (with speedups)
mod_python 3.3.1
MySQL server: "5.5.47-0+deb7u1", client: "5.5.47", thread-safe: 1
MySQLdb 1.2.3
Pygments 1.5
Python 2.7.3 (default, Mar 14 2014, 12:14:27)
[GCC 4.7.2]
pytz 2012c
setuptools 0.6
Subversion 1.6.17 (r1128011)
jQuery 1.7.2

Enabled Plugins

binary-agilo 1.3.15
ticketsboardplugin.assignreviewer N/A
ticketsboardplugin.web-ui N/A

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.7/dist-packages/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-i686/egg/ticketsboardplugin/web_ui.py", line 204, in process_request
  File "build/bdist.linux-i686/egg/ticketsboardplugin/web_ui.py", line 349, in _update_tickets_changes
KeyError: u'new'

Attachments (1)

trac.ini (11.1 KB) - added by Ryan J Ollos 8 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by anonymous

Adding Attachments is not available: (IndexError: pop from empty list)

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:2 in reply to:  1 Changed 8 years ago by Ryan J Ollos

Replying to anonymous:

Adding Attachments is not available: (IndexError: pop from empty list)

Fixed now.

Changed 8 years ago by Ryan J Ollos

Attachment: trac.ini added

comment:3 Changed 8 years ago by Ryan J Ollos

You can avoid the error by upgrading to a newer version of Trac, such as the latest 1.0-stable, which is 1.0.13. The exception is not seen in newer versions of Trac 1.0-stable because states_action returns a default dict for unknown key (since trac:r13444, included in Trac 1.0.3).

It appears the code is not doing what it's intended to do though, so a proper fix will be needed to make the plugin fully functional. On the line where the exception is generated, the status is used as a key for the states_action dict, however the keys of the dict are actions, not statuses.

Given the first commit for this plugin was 2015-02-19 and 1.0.3 was released about a month before that, it could be the case that the plugin was developed against Trac 1.0.3, and so the error went unnoticed by the developer.

comment:4 Changed 8 years ago by anonymous

Thanks for the advice. I was upgrading trac to Version 1.0.13 in our maintaince window today. (trac.ini was not changed) Now i got a other issue by clicking the save button after: "TypeError: save_changes() takes at least 3 arguments (2 given)"

(I move a ticket from new to reviewing and click the save button.)

Do you have any idea how to fix it?

How to Reproduce

While doing a POST operation on /ticketsboard, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{u'__FORM_TOKEN': u'b4df37a949c2a358a7a920d8',
 u'ticketsboard_changes': u'2667:status=reviewing',
 u'ticketsboard_submit': u'Save Changes',
 u'user': u''}

User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

System Information

Trac 1.0.13
Agilo 1.3.15
Babel 0.9.6
Docutils 0.8.1
Genshi 0.6 (with speedups)
mod_python 3.3.1
MySQL server: "5.5.47-0+deb7u1", client: "5.5.47", thread-safe: 1
MySQLdb 1.2.3
Pygments 1.5
Python 2.7.3 (default, Mar 14 2014, 12:14:27)
[GCC 4.7.2]
pytz 2012c
setuptools 0.6
Subversion 1.6.17 (r1128011)
jQuery 1.7.2
jQuery UI 1.8.4
jQuery Timepicker 1.0.1

Enabled Plugins

binary-agilo 1.3.15
ticketsboardplugin 1.2.3-trac0.12dev

Python Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.13-py2.7.egg/trac/web/main.py", line 562, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.13-py2.7.egg/trac/web/main.py", line 249, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.7/dist-packages/ticketsboardplugin-1.2.3_trac0.12dev-py2.7.egg/ticketsboardplugin/web_ui.py", line 204, in process_request
    self.states_actions)
  File "/usr/local/lib/python2.7/dist-packages/ticketsboardplugin-1.2.3_trac0.12dev-py2.7.egg/ticketsboardplugin/web_ui.py", line 386, in _update_tickets_changes
    t.save_changes(req.authname)
TypeError: save_changes() takes at least 3 arguments (2 given)

comment:5 Changed 8 years ago by Ryan J Ollos

I guess that Agilo has overridden save_changes, a method that normally has all optional arguments: browser:tags/trac-1.0.3/trac/ticket/model.py@:260#L260. I'll commit a workaround.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

comment:6 Changed 8 years ago by Ryan J Ollos

I downloaded the Agilo source:

    # OVERRIDE
    def save_changes(self, author, comment, when=None, db=None, cnum='', replyto=''):
        """
        Store ticket changes in the database. The ticket must already exist in
        the database.  Returns False if there were no changes to save, True
        otherwise.
        """

comment:7 Changed 8 years ago by Ryan J Ollos

In 16237:

1.2.3-trac0.12dev: Add optional comment argument

This is a workaround for Agilo overridding the method
and using a different signature.

Refs #13069.

comment:8 Changed 8 years ago by anonymous

Hi, thanks it is working now fine.

With the new Parameter for t.save_changes, the ticketboard is able to save the changes. Thanks very much, this will reduce some work at our side.

This defect can be closed.

comment:9 in reply to:  3 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Replying to Ryan J Ollos:

It appears the code is not doing what it's intended to do though, so a proper fix will be needed to make the plugin fully functional. On the line where the exception is generated, the status is used as a key for the states_action dict, however the keys of the dict are actions, not statuses.

=> #13093.

Modify Ticket

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