Table rendering broken for certain objects

Bug #1278956 reported by Brian DeHamer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Brian DeHamer

Bug Description

The patch that was submitted for Bug #1203391 (https://bugs.launchpad.net/horizon/+bug/1203391) introduced a slight refactoring of the Column.get_raw_data method (https://github.com/openstack/horizon/commit/abb76704d014eab68dc0aabe6c8d1d0d762e56e9#diff-0). Specifically, the ordering of the Dict lookup and basic object lookup was reversed.

Unfortunately, this results in errors for certain objects that may want to be rendered in a table. Any object which is iterable will be treated as a dictionary. However, an error will be raised if that object doesn't also implement a 'get' method (called on line 312). I have a few pages which use tables to display data from mongoengine-based models -- these models are iterable, but do NOT implement a get method and are now resulting in errors when rendered in a table.

  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 1553, in get_rows
    row = self._meta.row_class(self, datum)
  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 477, in __init__
    self.load_cells()
  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 503, in load_cells
    cell = table._meta.cell_class(datum, column, self)
  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 592, in __init__
    self.data = self.get_data(datum, column, row)
  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 628, in get_data
    data = column.get_data(datum)
  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 339, in get_data
    data = self.get_raw_data(datum)
  File "/adminui/.venv/local/lib/python2.7/site-packages/horizon/tables/base.py", line 308, in get_raw_data
    if callable(self.transform):
AttributeError: 'Application' object has no attribute 'get'

Changed in horizon:
assignee: nobody → Brian DeHamer (brian-dehamer)
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/72722

Changed in horizon:
status: New → In Progress
Matthias Runge (mrunge)
Changed in horizon:
milestone: none → icehouse-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/72722
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=c93f228671e74fef4db8e21b3eeee81f6b355069
Submitter: Jenkins
Branch: master

commit c93f228671e74fef4db8e21b3eeee81f6b355069
Author: Brian DeHamer <email address hidden>
Date: Tue Feb 11 10:13:19 2014 -0800

    Fix table rendering for iterable objects

    Table rendering is broken for objects which are iterable but do NOT
    implement a 'get' method. This patch ensures that we don't try to
    invoke a 'get' method on objects which don't support it.

    Change-Id: If29946f8c553b85a03ea6c50b0cf74f3ba787d0b
    Closes-Bug: #1278956

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: icehouse-3 → 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.