Skip to content

Commit 6034c50

Browse files
committed
#2274: cache_model.py, add 'else' case for no model found
1 parent 6e30c13 commit 6034c50

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

brain/cache/cache_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ 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 {'result': None, 'error': 'no previous model found in cache'}
9396
except Exception, error:
9497
self.list_error.append(str(error))
9598
return {'result': None, 'error': self.list_error}

0 commit comments

Comments
 (0)