Prevent KeyError getting value of optional data
Bug #2066115 reported by
Nguyen Luu Hoang Minh
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Dashboard (Horizon) |
In Progress
|
Undecided
|
Nguyen Luu Hoang Minh |
Bug Description
Problem: Some of optional data is retrieved in this way:
backup_name = data['backup_name'] or None
volume_id = data['volume_id'] or None
etc...
When the key does not exist, KeyError will be raised.
Moreover, or None here is meaningless.
Solution:
Change to
backup_name = data.get(
volume_id = data.get(
Changed in horizon: | |
assignee: | nobody → Nguyen Luu Hoang Minh (minhnlh2) |
To post a comment you must log in.
Fix proposed to branch: master /review. opendev. org/c/openstack /horizon/ +/919430
Review: https:/