Modify

Opened 12 years ago

Last modified 12 years ago

#9838 assigned defect

NameError: global name 'fieldname' is not defined

Reported by: didley@… Owned by: Chris Nelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

I'm using childticketplugin also. Is the parent field empty JSGantt works. Is parent field filled with a number for example #XXXX than it fails with error below.

 Traceback (most recent call last):
  File "C:\Programme\Python25\lib\site-packages\trac-0.12.2-py2.5.egg\trac\wiki\formatter.py", line 717, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File "C:\Programme\Python25\lib\site-packages\trac-0.12.2-py2.5.egg\trac\wiki\formatter.py", line 304, in process
    text = self.processor(text)
  File "C:\Programme\Python25\lib\site-packages\trac-0.12.2-py2.5.egg\trac\wiki\formatter.py", line 291, in _macro_processor
    text)
  File "build\bdist.win32\egg\tracjsgantt\tracjsgantt.py", line 621, in expand_macro
    tasks = self._add_tasks(options)
  File "build\bdist.win32\egg\tracjsgantt\tracjsgantt.py", line 559, in _add_tasks
    self.pm.postQuery(options, self.tickets)
  File "build\bdist.win32\egg\tracjsgantt\tracpm.py", line 643, in postQuery
    t[fieldname] = parent[1:]
NameError: global name 'fieldname' is not defined

I checked this part of coding where the error comes up but I can't find any error. Do you have any idea?

    def postQuery(self, options, tickets):
        # Handle custom fields.

        # Clean up custom fields which might be null ('--') vs. blank ('')
...

        # Normalize parent field values.  All parent values must be
        # done before building child lists, below.
        if self.isCfg('parent'):
            for t in tickets:
                # ChildTicketsPlugin puts '#' at the start of the
                # parent field.  Strip it for simplicity.
                fieldName = self.fields[self.sources['parent']]
                parent = t[fieldName]
                if len(parent) > 0 and parent[0] == '#':
                    t[fieldname] = parent[1:]

didley

Attachments (0)

Change History (5)

comment:1 Changed 12 years ago by anonymous

note case of "n" on last line t[fieldName] (right) vs. t[fieldname] (presumably wrong)

comment:2 Changed 12 years ago by didley@…

You are right. I changed it and now it work.

Thanx

comment:3 Changed 12 years ago by Chris Nelson

Status: newassigned

comment:4 Changed 12 years ago by Chris Nelson

(In [11403]) Typo in variable name. Refs #9838.

comment:5 Changed 12 years ago by Chris Nelson

(In [11414]) If a predecessor has children, they are also predecessors. Refs #9838.

Also fix a bug in finding roots. Refs #8790, #8574.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Chris Nelson.

Add Comment


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

 
Note: See TracTickets for help on using tickets.