From 95c39e5094a3b1689d213172041a830def1b692f Mon Sep 17 00:00:00 2001 From: Victoria Martinez de la Cruz Date: Thu, 22 Mar 2018 17:39:55 -0300 Subject: [PATCH] Fix warnings on py27 environment AttributeError exceptions were being hit due to share_group_id and revert_to_snapshot_support attributes trying to be accessed directly when they are not always available. Change-Id: Ic0169bfa4c6b2e747eff1b4cf63b473e58aadda6 --- manila_ui/dashboards/project/shares/tables.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manila_ui/dashboards/project/shares/tables.py b/manila_ui/dashboards/project/shares/tables.py index b3593375..23cc5d54 100644 --- a/manila_ui/dashboards/project/shares/tables.py +++ b/manila_ui/dashboards/project/shares/tables.py @@ -167,7 +167,7 @@ class RevertShare(tables.LinkAction): def allowed(self, request, share=None): return ( - share.revert_to_snapshot_support and + getattr(share, 'revert_to_snapshot_support', False) and share.status.lower() == "available" ) @@ -255,7 +255,8 @@ class SharesTableBase(tables.DataTable): return obj.name or obj.id def get_share_group_link(share): - if features.is_share_groups_enabled() and share.share_group_id: + if (features.is_share_groups_enabled() and + getattr(share, 'share_group_id', None)): return reverse( "horizon:project:share_groups:detail", args=(share.share_group_id,))