Fixing potential attribute access on None
Specifically when writing tests, the nav method in the settings dashboard.py file can potentially attempt to access slug on None. Closes-bug: #1291050 Change-Id: I6df58d26f5df71ac7c605c5d77b9aa9d8d811956
This commit is contained in:
parent
6de70303cf
commit
ab3cdfd1c9
@ -27,7 +27,8 @@ class Settings(horizon.Dashboard):
|
||||
default_panel = 'user'
|
||||
|
||||
def nav(self, context):
|
||||
if context['request'].horizon.get('dashboard', None).slug == self.slug:
|
||||
dash = context['request'].horizon.get('dashboard', None)
|
||||
if dash and dash.slug == self.slug:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user