Opened 13 years ago
Closed 12 years ago
#9659 closed defect (fixed)
ResourceNotFound error when updating grid on ActiveTickets screen
Reported by: | C. G. Brown | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | GridModifyPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description (last modified by )
- Trac 0.11.7
- GridModify 0.1.3 and 0.1.5
- Firefox 8.0.1 and Chrome 16.0.912.63
I take the following steps as a TRAC_ADMIN
with the GridModify plugin enabled:
- Go to the View Tickets link
- Go to the Active Tickets Screen
- Attempt to update component
I get a red X back. When I run this in Firebug, I get a 500 error against a URL of the form:
When I run the update link that is fired off as an AJAX call in my web browser, I get the message:
Oops... Traceback (most recent call last): File "/usr/local/lib/python2.5/site-packages/GridModify-0.1.3-py2.5.egg/gridmod/web_ui.py", line 56, in process_request ticket = Ticket(self.env, id) File "/usr/local/lib/python2.5/site-packages/Trac-0.11.7-py2.5.egg/trac/ticket/model.py", line 50, in __init__ self._fetch_ticket(tkt_id, db) File "/usr/local/lib/python2.5/site-packages/Trac-0.11.7-py2.5.egg/trac/ticket/model.py", line 102, in _fetch_ticket 'Invalid Ticket Number') ResourceNotFound: Ticket 323456789101112131415 does not exist.
It appears to be merging the ticket numbers from the entire grid. It renders the plugin unusable, unfortunately.
I'm going to take a look at the CSS selection that the JS is doing and see if I can propose a patch. Is there anything I'm doing wrong or should be considering when evaluating the issue here?
Attachments (2)
Change History (9)
comment:1 Changed 13 years ago by
Owner: | changed from Björn Harrtell to C. G. Brown |
---|---|
Status: | new → assigned |
Changed 13 years ago by
Attachment: | grid_modify_plugin_jquery_parent_patch.diff added |
---|
comment:2 follow-up: 6 Changed 13 years ago by
Owner: | changed from C. G. Brown to Björn Harrtell |
---|---|
Status: | assigned → new |
I've attached a proposed fix. Inspection in Firebug and Web Inspector showed me that on line 75 of the gridmod.js file, $(this).parents('tr') was returning all of the parents. The text was being concatenated, which produced the problem. I replaced that with $(this).parent('td').parent('tr'), which calls the ancestor directly above the line in question and no others. This seemed to fix the problem on our servers.
This would have been a showstopper if it happened for everyone, so the most likely cause is a difference or change in jQuery semantics, depending on what version of jQuery you're running. It's possible that in some versions .parents() returns the first ancestor that fits instead of all of them. Our Trac appears to be running jQuery 1.2.6.
At any rate, the fix above should work in both cases. I'll reassign to the project owner for review and committing at his leisure.
comment:3 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:4 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:5 Changed 12 years ago by
Owner: | changed from Björn Harrtell to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:6 Changed 12 years ago by
Replying to cgbrown:
I've attached a proposed fix. Inspection in Firebug and Web Inspector showed me that on line 75 of the gridmod.js file, $(this).parents('tr') was returning all of the parents. The text was being concatenated, which produced the problem.
Do you mean, the parent tr
and all of its siblings, or were you finding that the element had multiple parent tr
s? The only way I can see this bug happening is if the immediate tr
had a parent tr
itself, or the parents
method was returning the tr
and siblings of the tr
. The documentation doesn't indicate that the siblings should be returned though, and I don't see that the tr
has a parent tr
itself when inspecting the DOM in Trac 0.11.7 (Chrome 22). A variant of your patch doesn't seem harmful though, and should make the application more robust regardless of what the problem is here.
If you have a chance, could you send me the DOM structure that exists in the scenario in which you can reproduce this issue? Also, please let me know what other plugins you are running. Finally, after gathering that information, please upgrade to incorporate the change I'm about to commit if you can, and report back if it fixes the problem for you.
Changed 12 years ago by
Attachment: | DomStructure.png added |
---|
comment:7 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
- Navigate the DOM more precisely to get the ticket id, by capturing just the parent
tr
, then its sibling with class.ticket
(Trac 0.11.7) or.id
(Trac 0.11). This should make the plugin more robust to template modifications. Note that we can't useclosest
since Trac 0.11 supports jQuery 1.2 andclosest
was added in jQuery 1.3. - Added support for console logging in Chrome, as described in http://stackoverflow.com/a/2757552.
Patch to make it choose one tr parent instead of all of them.