Skip to content

Commit a8d0a3f

Browse files
committed
KeyException fixed
1 parent 3f6fea6 commit a8d0a3f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ui/ui.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def get_page_by_id (page_id):
6565
return g.db.pages.find_one( {'_id': page_id} )
6666

6767
def get_page_score (page_id):
68-
return len(g.db.pages.find_one({ '_id': page_id })['ref_pages'])
68+
page = get_page_by_id(page_id)
69+
return len(page['ref_pages']) if page and 'ref_pages' in page else 0
6970

7071
def intersect(a, b):
7172
return list(set(a) & set(b))

0 commit comments

Comments
 (0)