yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #08835
[Bug 1203391] Re: Horizon should be much more tolerant of missing values
** Changed in: horizon
Status: Fix Committed => Fix Released
** Changed in: horizon
Milestone: None => icehouse-2
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1203391
Title:
Horizon should be much more tolerant of missing values
Status in OpenStack Dashboard (Horizon):
Fix Released
Bug description:
I'd like to propose a simple improvement. Consider
openstack_dashboard/dashboards/admin/hypervisors/tables.py (I've
pasted the relevant bits below). If vcpus is missing from the JSON
data, Horizon prints a nice dash in the column. That's great. If
memory_mb is missing, get_memory throws an AttributeError, and Horizon
500-errors.
I'd like to propose that instead Horizon tables.Column should tolerate
AttributeError being thrown by the getter/formatter function.
There are two easy ways this could be done:
1) Add another attribute "if_present" to tables.Column, and only call the getter function if the attribute is present.
2) Catch AttributeError and tolerate it. (Maybe only if "ignore_attribute_error" is specified, but I think this should be the default)
I think my preference is #2, so that we don't need to change the code
for every table.
----
def get_memory(hypervisor):
return _("%s MB") % hypervisor.memory_mb
...
class AdminHypervisorsTable(tables.DataTable):
...
vcpus = tables.Column("vcpus",
verbose_name=_("VCPUs (total)"))
...
memory = tables.Column(get_memory,
verbose_name=_("RAM (total)"),
attrs={'data-type': 'size'})
To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1203391/+subscriptions