Opened 16 months ago

Closed 16 months ago

Last modified 13 months ago

#11026 closed defect (fixed)

Traceback when succ and pred are not configured

Reported by: rjollos Owned by: ChrisNelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: airmank@… Trac Release:

Description (last modified by rjollos)

I just installed the plugin in a dev environment and haven't specified any configuration yet. On line 2508 of, 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/

    diff --git a/tracjsganttplugin/0.11/tracjsgantt/ b/tracjsganttplugin/0.
    index 4d4b4e2..86eb6fb 100644
    a b class TicketRescheduler(Component): 
    25052505        # FIXME - this is a really gross and fragile way to do it but 
    25062506        # it'll due for now. 
    25072507        linkFieldNames = {} 
    2508         for linkField in [ 'parent', 'pred', 'succ']: 
     2508        for linkField in ['parent', 'pred', 'succ']: 
    25092509            if not 
    25102510                linkFieldNames[linkField] = None 
    25112511            elif 
    class TicketRescheduler(Component): 
    25282528            # Predecessors and successors 
    25292529            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]] 
    25322533                         if tid in ticketsByID] 
    25342535        return tickets 

I can go ahead and push this change if you are okay with it.

Attachments (0)

Change History (7)

comment:1 Changed 16 months ago by rjollos

  • Description modified (diff)

comment:2 Changed 16 months ago by rjollos

There are also a few tabs in and that 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.

comment:3 Changed 16 months ago by ChrisNelson

  • Status changed from new to assigned

Sure. Go ahead and push these. Thanks.

comment:4 Changed 16 months ago by rjollos

(In [12997]) Refs #11026: Check whether linkFieldName[linkField] is None before trying to use it as a key.

comment:5 Changed 16 months ago by rjollos

(In [12998]) Refs #11026: Replaced tabs with spaces.

comment:6 Changed 16 months ago by rjollos

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

Thanks Chris. Let me know if you see any issues with the changes I pushed..

comment:7 Changed 13 months ago by petekalo

  • Cc airmank@… added

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 !=]
2622	                # Add ticket to children of new parent
2623	                parent = ticketsByID[ticket[linkFieldsNames['parent']]]
2624	                if not in parent['children']:
2625	                    parent['children'].append(

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/", line 497, in _dispatch_request
File "/usr/lib/python2.6/site-packages/trac/web/", line 214, in dispatch
  resp = chosen_handler.process_request(req)
File "/usr/lib/python2.6/site-packages/trac/ticket/", line 179, in process_request
  return self._process_ticket_request(req)
File "/usr/lib/python2.6/site-packages/trac/ticket/", line 614, in _process_ticket_request
  self._do_save(req, ticket, action)
File "/usr/lib/python2.6/site-packages/trac/ticket/", line 1328, in _do_save
File "/usr/lib/python2.6/site-packages/trac/ticket/", line 365, in save_changes
  listener.ticket_changed(self, comment, author, old_values)
File "build/bdist.linux-x86_64/egg/tracjsgantt/", line 2950, in ticket_changed
  self.rescheduleTickets(ticket, old_values)
File "build/bdist.linux-x86_64/egg/tracjsgantt/", line 2759, in rescheduleTickets
  self.spliceGraph(tickets, ticket, old_values)
File "build/bdist.linux-x86_64/egg/tracjsgantt/", 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!

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.