From 82b90adf2d24be53168de437ac5c7cccf8dc0708 Mon Sep 17 00:00:00 2001 From: Matthew Scragg Date: Fri, 26 Feb 2016 17:07:57 -0600 Subject: [PATCH] fix bug in simple search --- realms/modules/search/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/realms/modules/search/models.py b/realms/modules/search/models.py index 0dfa89f..3a37ac7 100644 --- a/realms/modules/search/models.py +++ b/realms/modules/search/models.py @@ -1,3 +1,4 @@ +import re import sys from flask import g, current_app @@ -40,9 +41,13 @@ class SimpleSearch(BaseSearch): res = [] for entry in g.current_wiki.get_index(): name = filename_to_cname(entry['name']) + name = re.sub(r"//+", '/', name) if set(query.split()).intersection(name.replace('/', '-').split('-')): page = g.current_wiki.get_page(name) - res.append(dict(name=name, content=page['data'])) + + # this can be None, not sure how + if page: + res.append(dict(name=name, content=page['data'])) return res def users(self, query):