Modify

Opened 8 years ago

Closed 8 years ago

#12589 closed defect (fixed)

overall_completion=as_bool(group.get('overall_completion'))) fails due to NoneType

Reported by: torresolmx@… Owned by: Rob Guttman
Priority: normal Component: SumStatsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

General behaviour

After installation and configuration, while trying to see the new roadmap, the following error is displayed and no roadmap is shown:

"AttributeError: 'NoneType' object has no attribute 'lower'"

Steps to reproduce

  • Trac 0.12 with a minimal set of other plugins.
  • Installed the plugin as documented in the plugin page.
  • The component was then enabled in trac.ini.
  • Replaced DefaultTicketGroupStatsProvider with this plugin's new SumTicketGroupStatsProvider in trac.ini in the [roadmap] section.
  • Added a custom text field called estimatedeffort in trac.ini
  • Added the following section to trac.ini
    [sumstats]
    field = estimatedeffort
    label = estimatedeffort
    
  • Restarted the web server
  • Tried to open the 'Roadmap' page in the trac environment.
    • The error "AttributeError: 'NoneType' object has no attribute 'lower'" is reported and no roadmap is shown.
  • As a check if nothing else was misconfigured, the gorup stats provider was reset to 'DefaultTicketGroupStatsProvider', and the original roadmap was shown again.

Bug details

In 'get_ticket_group_stats' while running:

                overall_completion=as_bool(group.get('overall_completion')))

group.get('overall_completion') evaluates to 'NoneType', making as_bool() fail.

Callback:

Most recent call last:

    File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 513, in _dispatch_request
    File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 235, in dispatch
    File "build/bdist.linux-x86_64/egg/trac/ticket/roadmap.py", line 350, in process_request
    File "build/bdist.linux-x86_64/egg/trac/ticket/roadmap.py", line 257, in get_ticket_stats
    File "build/bdist.linux-x86_64/egg/sumstats/web_ui.py", line 163, in get_ticket_group_stats 

Local variable contents:

group 	{'status': u'assigned,new,accepted,reopened', 'css_class': 'open', ...
self 	<sumstats.web_ui.SumTicketGroupStatsProvider object at 0x7f93c6a935d0>
stat 	<trac.ticket.roadmap.TicketGroupStats object at 0x7f93c6889290>
ticket_ids 	[1, 31, 22, 24, 37, 52, 53, 106, 15, 28, 30, 34, 35, 36, 38, 44, 45, 57, ...

Attachments (0)

Change History (3)

comment:1 Changed 8 years ago by Ryan J Ollos

as_bool in Trac 0.12 was less robust than it is now:

In 0.12:

>>> as_bool(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 5, in as_bool
AttributeError: 'NoneType' object has no attribute 'lower'
>>> as_bool('')
False

Therefore we should probably make the change:

-overall_completion=as_bool(group.get('overall_completion')))
+overall_completion=as_bool(group.get('overall_completion', '')))

comment:2 Changed 8 years ago by Ryan J Ollos

I'll push the untested fix. Please comment if you continue to have issues after updating to the latest.

comment:3 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 15069:

0.9.1dev: Fix traceback when overall_completion is None

The issue occurs in Trac 0.12 - as_bool was not as
robust as in later versions of Trac.

Fixes #12589.

Modify Ticket

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