Opened 9 years ago

Closed 4 years ago

priority/milestone/component/version get repeated twice for users without TICKET_ADMIN permissions

Reported by: Owned by: thomasvs Noah Kantrowitz normal CondFieldsPlugin normal fixed condfields null 0.10

Description

I'm not sure how to narrow this down in the code. I had one user complain that he saw these four fields twice, and hence Trac was giving a traceback when trying to submit:

Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 387, in dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 279, in process_request
self._do_save(req, db, ticket)
File "/usr/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 506, in _do_save
ticket.populate(req.args)
File "/usr/lib/python2.4/site-packages/trac/ticket/model.py", line 124, in populate
self[name] = values.get(name, '')
File "/usr/lib/python2.4/site-packages/trac/ticket/model.py", line 117, in __setitem__
value = value.strip()
AttributeError: 'list' object has no attribute 'strip'


Looks like usually a form value goes into a string, and now because there are duplicates it went into a list of str

The problem went away when giving the user TRAC_ADMIN or TICKET_ADMIN, but not with any of the other TICKET_* permissions.

What more info would you want to be able to diagnose this ?

comment:1 Changed 9 years ago by thomasvs

some further notes:

• with "view source", you don't see the duplicate fields
• firebug does show HTML code for the duplicate fields
• I assume that the plugin's code is rewriting the HTML object model using javascript on the fly

comment:2 Changed 9 years ago by steve@…

I have 30+ users on nearly identical setups and two of them have this problem. Stepping through the JS in Firebug I can see the duplication occurring but cannot see why those fields are treated differently on only those two machines 100% of the time.

This is a Firefox-only problem so the work-around is just to use IE, but this is far from ideal.

I would be more than happy to try any fixes suggested.

comment:3 Changed 9 years ago by Sergio Talens-Oliag

I've had the same problem and I've found that the bug is on the condfields/templates/condfields.cs file.

The problem apperars when removing rows from the table from javascript; the current code asumes that there are three valid rows when changing properties, but that is not the case when the user can't change the Description and Reported fields and it leaves original fields and re-adds them.

I'm attaching a patch that solves the problem form me on firefox. I don't have experience with javascript or jQuery, so I'm unsure if it works on other browsers, but I belive that the right fix must be close to mine.

comment:4 Changed 9 years ago by anonymous

Keywords: fixed condfields null added → fixed new → closed defect → enhancement

got 2 problems fixed: condfields is null and double shown fields. condfields.cs ist fixed an runable version. Testet with firefox and IE6 (no more script errors!)

comment:5 Changed 9 years ago by anonymous

Resolution: fixed closed → reopened

Not actually fixed, leave it open or I will never see it.

comment:6 Changed 8 years ago by thomasvs

I did the same debugging today with Firebug and noticed the same problem as in comment 2.

I tried the attached condfields.cs and it did indeed fix the problem for me.

I must say that the .cs code is hard to follow, comments would have helped to understand that magic number of 3!

I would commit this change so this bug can be closed.

comment:7 Changed 8 years ago by anonymous

the patch condfields_ticket_2042.2.patch is mixing javascript and python. Change "and" in the if statement to "&&".

comment:8 Changed 4 years ago by Ryan J Ollos

Resolution: → wontfix reopened → closed

The 0.10 version of this plugin is no longer supported. If you can reproduce the issue with the 0.11 branch and Trac 0.11 or later, please create a new ticket and I will promptly fix the issue.

Modify Ticket

Action
as closed The owner will remain Noah Kantrowitz.
The resolution will be deleted. Next status will be 'reopened'.