Skip to content

Commit 09a74a9

Browse files
committed
Merge pull request #2276 from jeff1evesque/bug-2274
#2274: cache_model.py, add 'else' case for no model found
2 parents cabb3ce + 05f4152 commit 09a74a9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

brain/cache/cache_model.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ def get_all_titles(self, name):
8989
list_title.append({'id': id[i], 'title': title[i]})
9090

9191
# return result
92-
return {'result': list_title, 'error': None}
92+
if list_title:
93+
return {'result': list_title, 'error': None}
94+
else:
95+
return {
96+
'result': None,
97+
'error': 'no previous model found in cache'
98+
}
9399
except Exception, error:
94100
self.list_error.append(str(error))
95101
return {'result': None, 'error': self.list_error}

0 commit comments

Comments
 (0)