Skip to content

Commit

Permalink
Merge pull request #2276 from jeff1evesque/bug-2274
Browse files Browse the repository at this point in the history
#2274: cache_model.py, add 'else' case for no model found
  • Loading branch information
jeff1evesque committed Nov 24, 2015
2 parents cabb3ce + 05f4152 commit 09a74a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion brain/cache/cache_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def get_all_titles(self, name):
list_title.append({'id': id[i], 'title': title[i]})

# return result
return {'result': list_title, 'error': None}
if list_title:
return {'result': list_title, 'error': None}
else:
return {
'result': None,
'error': 'no previous model found in cache'
}
except Exception, error:
self.list_error.append(str(error))
return {'result': None, 'error': self.list_error}

0 comments on commit 09a74a9

Please sign in to comment.