Modify ↓
Opened 6 years ago
Closed 4 years ago
#13463 closed defect (fixed)
TypeError: object of type 'NoneType' has no len()
Reported by: | Rochi | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | TracJsGanttPlugin |
Severity: | normal | Keywords: | patch |
Cc: | Trac Release: | 1.2 |
Description
Using: Trac 1.2.3 Trac_jsGantt-1.2.0.0.dev0
Error was:
2018-07-30 16:45:48,869 Trac[formatter] ERROR: Macro TracJSGanttChart(milestone=Organisatorisches,display=status:new|status:assigned|status:accepted,res=0,startDate=0) failed for <Resource u'wiki:WikiStart'>: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-1.2.3-py2.7.egg/trac/wiki/formatter.py", line 822, in _macro_formatter return macro.ensure_inline(macro.process(args), in_paragraph) File "/usr/local/lib/python2.7/dist-packages/Trac-1.2.3-py2.7.egg/trac/wiki/formatter.py", line 396, in process text = self.processor(text) File "/usr/local/lib/python2.7/dist-packages/Trac-1.2.3-py2.7.egg/trac/wiki/formatter.py", line 368, in _macro_processor text) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracjsgantt.py", line 751, in expand_macro tasks = self._add_tasks(options) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracjsgantt.py", line 692, in _add_tasks self.pm.computeSchedule(options, self.tickets) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracpm.py", line 1250, in computeSchedule self.scheduler.scheduleTasks(options, ticketsByID) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracpm.py", line 2238, in scheduleTasks serialSGS(_schedule_task_alap, 'nsucc', -1, self.pm.predecessors) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracpm.py", line 2194, in serialSGS scheduleFunction(ticket) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracpm.py", line 2022, in _schedule_task_alap _compare_alap_limits, _wrap_alap_day) File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracpm.py", line 1786, in _schedule_task elif self.pm.isSet(t, fromField): File "/usr/local/lib/python2.7/dist-packages/Trac_jsGantt-1.2.0.0.dev0-py2.7.egg/tracjsgantt/tracpm.py", line 343, in isSet len(ticket[self.fields[field]]) != 0: TypeError: object of type 'NoneType' has no len()
Fixed it with:
# Return True if ticket has a non-empty value for field, False # otherwise. def isSet(self, ticket, field): if self.isCfg(field) and \ isinstance(ticket[self.fields[field]], datetime) and \ len(str(ticket[self.fields[field]])) != 0: return True elif self.isCfg(field) and \ ticket[self.fields[field]] is not None and \ len(ticket[self.fields[field]]) != 0: return True else: return False
Attachments (0)
Change History (8)
comment:1 Changed 6 years ago by
Keywords: | patch added |
---|
comment:2 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 6 years ago by
Owner: | changed from Chris Nelson to Rochi |
---|
comment:4 Changed 5 years ago by
FYI, got that error again (TRAC 1.2.3 + Trac-jsGantt 1.2.0.0.dev0), having cutom-fields
userfinish = time userfinish.format = time userfinish.label = Due DateTime userfinish.order = 18 userfinish.value = userstart = time userstart.format = time userstart.label = Start DateTime userstart.order = 17 userstart.value =
then leaving either userstart or userfinish unset. The following mod of isSet()
WFM
def isSet(self, ticket, field): if self.isCfg(field) and ticket[self.fields[field]] is not None: if len(str(ticket[self.fields[field]])) != 0: return True else: return False else: return False
comment:5 Changed 5 years ago by
How about this?
-
tracjsgantt/tracpm.py
336 336 # Return True if ticket has a non-empty value for field, False 337 337 # otherwise. 338 338 def isSet(self, ticket, field): 339 if self.isCfg(field) and \ 340 isinstance(ticket[self.fields[field]], datetime) and \ 341 ticket[self.fields[field]] is not None and \ 342 len(str(ticket[self.fields[field]])) != 0: 343 return True 344 elif self.isCfg(field) and \ 345 len(ticket[self.fields[field]]) != 0: 346 return True 347 else: 348 return False 339 return bool(self.isCfg(field) and ticket.get(self.fields[field])) 349 340 350 341 # FIXME - Many of these should be marked as more private. Perhaps 351 342 # an leading underscore?
comment:6 Changed 5 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:7 Changed 5 years ago by
Owner: | changed from Rochi to Ryan J Ollos |
---|---|
Status: | reopened → accepted |
comment:8 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Note: See
TracTickets for help on using
tickets.
In 17250: