Improved handling of Swift panel detection

The initial handling of the Swift panel detection can be improved
by more closely following the way the detection is done in the
Swift Horizon code.  Namely, if the setting is not angular then the
original default Django panel will be enabled.

Also added code to detect if the setting is missing which would
also result in the default Django panel being the default.

Change-Id: I8d7a44c84405f291780a6767bcb375ba980f3a7a
This commit is contained in:
Duk Loi 2016-03-23 15:03:06 -04:00
parent c2e42436ad
commit a3c2ee6f83

View File

@ -87,8 +87,11 @@ class DownloadBackup(tables.LinkAction):
'object_path': object_path})
def allowed(self, request, datum):
return ((settings.HORIZON_CONFIG['swift_panel'] == 'legacy') and
datum.status == 'COMPLETED')
legacy_swift_panel_enabled = True
if ('swift_panel' in settings.HORIZON_CONFIG and
settings.HORIZON_CONFIG['swift_panel'] == 'angular'):
legacy_swift_panel_enabled = False
return legacy_swift_panel_enabled and datum.status == 'COMPLETED'
class DeleteBackup(tables.DeleteAction):