#11026 closed defect (fixed)
Traceback when succ and pred are not configured
| Reported by: | Ryan J Ollos | Owned by: | Chris Nelson |
|---|---|---|---|
| Priority: | normal | Component: | TracJsGanttPlugin |
| Severity: | normal | Keywords: | |
| Cc: | pete | Trac Release: |
Description (last modified by )
I just installed the plugin in a dev environment and haven't specified any configuration yet. On line 2508 of tracpm.py, entries in linkFieldNames are set to None if the field hasn't been configured, but then there is no check as to whether linkFieldName[linkField] is None before trying to use it as a key in tickets:
-
tracjsganttplugin/0.11/tracjsgantt/tracpm.py
diff --git a/tracjsganttplugin/0.11/tracjsgantt/tracpm.py b/tracjsganttplugin/0. index 4d4b4e2..86eb6fb 100644
a b class TicketRescheduler(Component): 2505 2505 # FIXME - this is a really gross and fragile way to do it but 2506 2506 # it'll due for now. 2507 2507 linkFieldNames = {} 2508 for linkField in [ 'parent', 'pred', 'succ']:2508 for linkField in ['parent', 'pred', 'succ']: 2509 2509 if not self.pm.isCfg(linkField): 2510 2510 linkFieldNames[linkField] = None 2511 2511 elif self.pm.isField(linkField): … … class TicketRescheduler(Component): 2527 2527 2528 2528 # Predecessors and successors 2529 2529 for linkField in ['pred', 'succ']: 2530 t[linkFieldNames[linkField]] = \ 2531 [tid for tid in t[linkFieldNames[linkField]] 2530 if linkFieldNames[linkField]: 2531 t[linkFieldNames[linkField]] = \ 2532 [tid for tid in t[linkFieldNames[linkField]] 2532 2533 if tid in ticketsByID] 2533 2534 2534 2535 return tickets
I can go ahead and push this change if you are okay with it.
Attachments (0)
Change History (7)
comment:1 Changed 13 years ago by
| Description: | modified (diff) |
|---|
comment:2 Changed 13 years ago by
comment:4 Changed 13 years ago by
comment:6 Changed 13 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Thanks Chris. Let me know if you see any issues with the changes I pushed..
comment:7 Changed 12 years ago by
| Cc: | pete added; anonymous removed |
|---|
I was having trouble with this bit of code, I think it appears to be related to this ticket:
2617 if linkFieldNames['parent'] in old_values: 2618 # Remove ticket from children of old parent 2619 parent = ticketsByID[old_values[[linkFieldsName['parent']]]] 2620 parent['children'] = \ 2621 [cid for cid in parent['children'] if cid != ticket.id] 2622 # Add ticket to children of new parent 2623 parent = ticketsByID[ticket[linkFieldsNames['parent']]] 2624 if ticket.id not in parent['children']: 2625 parent['children'].append(ticket.id)
There are linkFieldsNames and linkFieldNames defined, is that a pluralization typo? I tried correcting it, I still get errors when trying to change a ticket's parent using the subtickets plugin.
Here is the output of the error:
Python Traceback
Most recent call last:
File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 497, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.6/site-packages/trac/web/main.py", line 214, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/lib/python2.6/site-packages/trac/ticket/web_ui.py", line 179, in process_request
return self._process_ticket_request(req)
File "/usr/lib/python2.6/site-packages/trac/ticket/web_ui.py", line 614, in _process_ticket_request
self._do_save(req, ticket, action)
File "/usr/lib/python2.6/site-packages/trac/ticket/web_ui.py", line 1328, in _do_save
replyto=req.args.get('replyto'))
File "/usr/lib/python2.6/site-packages/trac/ticket/model.py", line 365, in save_changes
listener.ticket_changed(self, comment, author, old_values)
File "build/bdist.linux-x86_64/egg/tracjsgantt/tracpm.py", line 2950, in ticket_changed
self.rescheduleTickets(ticket, old_values)
File "build/bdist.linux-x86_64/egg/tracjsgantt/tracpm.py", line 2759, in rescheduleTickets
self.spliceGraph(tickets, ticket, old_values)
File "build/bdist.linux-x86_64/egg/tracjsgantt/tracpm.py", line 2619, in spliceGraph
parent = ticketsByID[old_values[[linkFieldNames['parent']]]]
here are the locals:
Local variables:
Name Value
f 'parents'
linkField 'succ'
linkFieldNames {'pred': None, 'succ': None, 'parent': u'parents'}
old_values {'parents': u'69'}
relationshipChanged True
self <tracjsgantt.tracpm.TicketRescheduler object at 0x7f67830c6450>
t {'status': u'active', u'totalhours': 0, 'description': u'Milestone 0.9.0 ...
ticket <trac.ticket.model.Ticket object at 0x7f67830bffd0>
tickets [{u'status': u'new', u'changetime': datetime.datetime(2013, 7, 11, 14, 46, ...
ticketsByID {64: {u'status': u'new', u'changetime': datetime.datetime(2013, 7, 22, 22, ...
Let me know if there is anything else we need. I do not have the succ and pred fields defined due to my use of the subtickets plugin. I assume that is the right course of action based on the plugin's wiki page.
Any ideas or help would be greatly appreciated, I am enjoying the plugin, great work!



There are also a few tabs in
tracjsgantt.pyandtracpm.pythat should be replaced with spaces so that we don't have files containing mixes of spaces/tabs. I have that change in my local Git copy and I'm happy to push that as well.