Merge "Fix for sessions that point to non-existing urls"

This commit is contained in:
Jenkins 2016-01-18 18:59:21 +00:00 committed by Gerrit Code Review
commit a49a0c6d20
2 changed files with 8 additions and 4 deletions

View File

@ -305,14 +305,18 @@ class Session(object):
def jobs(self, session_id):
session = self.get(session_id, json=True)
jobs = []
if session is None:
return jobs
try:
jobs = [utils.JobsInSessionObject(k,
session_id,
v['client_id'],
v['result'])
for k, v in session['jobs'].iteritems()]
except AttributeError:
pass
except AttributeError as error:
LOG.error(error.message)
return jobs
def _build(self, session):

View File

@ -32,11 +32,11 @@ class SessionsView(browsers.ResourceBrowserView):
browser_class = project_browsers.SessionBrowser
template_name = "disaster_recovery/sessions/browser.html"
@shield('Unable to get sessions list.', redirect='actions:index')
@shield('Unable to get sessions list.', redirect='sessions:index')
def get_sessions_data(self):
return freezer_api.Session(self.request).list(limit=100)
@shield('Unable to get job list.', redirect='actions:index')
@shield('Unable to get job list.', redirect='sessions:index')
def get_jobs_data(self):
if self.kwargs['session_id']:
return freezer_api.Session(self.request).jobs(