Modify

Opened 6 years ago

Closed 6 years ago

#9270 closed defect (fixed)

[Patch] "Local variable referenced before assignment" error (r10732)

Reported by: Ryan J Ollos Owned by: Chris Nelson
Priority: high Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Following some change to a ticket, the Gantt chart stopped displaying. This occurs with r10732 of the plugin. We now see this:

I hope to send you a patch shortly.

Attachments (2)

LocalVariableStartReferrenedBeforeAssignment.png (8.0 KB) - added by Ryan J Ollos 6 years ago.
th9270-r10732-0.11.7.patch (718 bytes) - added by Ryan J Ollos 6 years ago.

Download all attachments as: .zip

Change History (10)

Changed 6 years ago by Ryan J Ollos

comment:1 Changed 6 years ago by Ryan J Ollos

Here is the traceback.

2011-10-15 15:16:29,216 Trac[formatter] ERROR: Macro TracJSGanttChart(milestone=M1 - I11, lwidth=600, colorBy=owner, expandClosedTickets=0, startDate=0, endDate=0, res=0) failed:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Trac-0.11.7-py2.6.egg/trac/wiki/formatter.py", line 484, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File "/usr/lib/python2.6/site-packages/Trac-0.11.7-py2.6.egg/trac/wiki/formatter.py", line 180, in process
    text = self.processor(text)
  File "/usr/lib/python2.6/site-packages/Trac-0.11.7-py2.6.egg/trac/wiki/formatter.py", line 167, in _macro_processor
    text)
  File "/usr/lib/python2.6/site-packages/Trac_jsGantt-0.9_r10732-py2.6.egg/tracjsgantt/tracjsgantt.py", line 1108, in expand_macro
    tasks = self._add_tasks(options)
  File "/usr/lib/python2.6/site-packages/Trac_jsGantt-0.9_r10732-py2.6.egg/tracjsgantt/tracjsgantt.py", line 1070, in _add_tasks
    self._schedule_tasks(options)
  File "/usr/lib/python2.6/site-packages/Trac_jsGantt-0.9_r10732-py2.6.egg/tracjsgantt/tracjsgantt.py", line 735, in _schedule_tasks
    _schedule_task_alap(t)
  File "/usr/lib/python2.6/site-packages/Trac_jsGantt-0.9_r10732-py2.6.egg/tracjsgantt/tracjsgantt.py", line 628, in _schedule_task_alap
    finish += timedelta(days=7-start.weekday())
UnboundLocalError: local variable 'start' referenced before assignment

Changed 6 years ago by Ryan J Ollos

Attachment: th9270-r10732-0.11.7.patch added

comment:2 Changed 6 years ago by Ryan J Ollos

Summary: "Local variable referenced before assignment" error (r10732)[Patch] "Local variable referenced before assignment" error (r10732)

Here is the patch.

comment:3 Changed 6 years ago by Ryan J Ollos

I've created a fork of this project at BitBucket so that I have a place to push my changes. I haven't used Git before, so please let me know if you have any suggestions on how I can do this better. Will it be easier for you to pull in this changes if I point you to the commit hash that contains the patch?

Here is the URL for the changeset that contains the patch for this ticket: https://bitbucket.org/rjollos/tracjsganttplugin/changeset/612501ab2531

comment:4 Changed 6 years ago by Chris Nelson

Status: newassigned

comment:5 in reply to:  3 ; Changed 6 years ago by Chris Nelson

Replying to rjollos:

I've created a fork of this project at BitBucket so that I have a place to push my changes.

I hope you mean clone, let's not diverge!

I haven't used Git before, so please let me know if you have any suggestions on how I can do this better.

Git hurts your head for a couple of months then you wonder how you ever lived without it.

Will it be easier for you to pull in this changes if I point you to the commit hash that contains the patch?

I dunno. Downloading a patch from TH is easy enough for me but I should be able to add BitBucket as an additional remote to my repo and cherry-pick your changes from there so that might be easier.

Here is the URL for the changeset that contains the patch for this ticket: https://bitbucket.org/rjollos/tracjsganttplugin/changeset/612501ab2531

I'll see if I can figure out how to use that.

comment:6 in reply to:  5 Changed 6 years ago by Ryan J Ollos

Replying to ChrisNelson:

I hope you mean clone, let's not diverge!

Well, yes I suppose I do (now that I stop and think about the actual meanings of those words ;). I'm anticipating pushing up changes to the BitBucket repository and associating each with a ticket so that you can pull in the ones that you want included in your plugin. So we could diverge perhaps slightly if you don't want to include a particular change, but any customization of your plugin would just be for my own use (e.g. #8947) in order to meet the demands my team has, and I don't intend to "advertize" my clone on trac-hacks or elsewhere. For one, although I'm happy to fix bugs and try to help you support other users, I don't want to support users on any forks of the plugin. And in general, I think that everyone doing there own thing and posting it all over trac-hacks just leads to us having a very disorganized community and is not something I want to promote.

comment:7 Changed 6 years ago by Chris Nelson

[10818] should have linked here.

comment:8 Changed 6 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

Modify Ticket

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