horizon.tables.Column() raises an exception for a valid arguments combination

Bug #1230400 reported by Timur Sufiev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Timur Sufiev

Bug Description

Say, if we pass some callable as first mandatory argument 'transform' of horizon.tables.Column __init__ method and do not provide 'verbose_name' optional argument, __init__ fails with an exception (I've cut off irrelevant part of stacktrace):

  File "/home/tsufiev/develop/murano-dashboard/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 215, in __init__
    verbose_name = self.transform.title()
AttributeError: 'function' object has no attribute 'title'

This is clearly a bug, because horizon.tables.Column should be able to derive 'verbose_name' from 'transform' even if it is callable.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/48297

Changed in horizon:
assignee: nobody → Timur Sufiev (tsufiev-x)
status: New → In Progress
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

I've made a fix for this issue: https://review.openstack.org/#/c/48297/

description: updated
Revision history for this message
Kieran Spear (kspear) wrote :

I don't necessarily have an issue with this fix, but I strongly suggest providing a verbose_name for every column because otherwise the name won't be translatable.

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

This can be also guaranteed by making verbose_name required, not optional.

David Lyle (david-lyle)
Changed in horizon:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/48297
Committed: http://github.com/openstack/horizon/commit/87265bc4d66493bab04b3bdc045ae989e732cb45
Submitter: Jenkins
Branch: master

commit 87265bc4d66493bab04b3bdc045ae989e732cb45
Author: Timur Sufiev <email address hidden>
Date: Tue Oct 22 12:45:37 2013 +0400

    Fix horizon.tables.Column __init__ method.

    __init__ method currently does not work (raises an exception)
    when 'transform' arg is callable and 'verbose_name' arg is absent.
    Fixed __init__ to use "" as default for 'verbose_name' when
    'transform' is callable.

    Change-Id: I45c7cd4502e7ea8c809f05ff0ed70b4f766c17fd
    Closes-bug: #1230400

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → icehouse-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.