Fixing a potential unbound local error

> UnboundLocalError: local variable 'records' referenced before assignment

If an exception is thrown and captured, records will be undefined.

Change-Id: I6f957e5ccc78b770c3ea9d2565df6663bd86991e
This commit is contained in:
Erik Olof Gunnar Andersson 2017-03-24 11:07:53 -07:00
parent 8113ea0add
commit f88e267c2b
1 changed files with 1 additions and 1 deletions

View File

@ -106,6 +106,7 @@ class RecordsView(tables.DataTableView):
def get_data(self):
domain_id = self.kwargs['domain_id']
records = []
try:
self.domain = api.designate.domain_get(self.request, domain_id)
self.servers = api.designate.server_list(self.request, domain_id)
@ -116,7 +117,6 @@ class RecordsView(tables.DataTableView):
_('Unable to retrieve record list.'),
redirect=redirect)
# TODO(Matt): This may not be defined here.
return records
def get_context_data(self, **kwargs):