From ca2c97819ddc0b9ce1bc512f6ada9f38b3aefe11 Mon Sep 17 00:00:00 2001 From: Bryan Date: Sun, 16 Aug 2015 20:36:36 -0400 Subject: [PATCH] indexden is now optional closes #443 --- karmaworld/apps/notes/search.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/karmaworld/apps/notes/search.py b/karmaworld/apps/notes/search.py index fd944af..d912e28 100644 --- a/karmaworld/apps/notes/search.py +++ b/karmaworld/apps/notes/search.py @@ -20,8 +20,15 @@ MOCK_MODE = settings.TESTING logging.basicConfig() logger = logging.getLogger(__name__) -INDEXDEN_INDEX = os.environ['INDEXDEN_INDEX'] -INDEXDEN_PRIVATE_URL = os.environ['INDEXDEN_PRIVATE_URL'] +# assume mock_mode if INDEXDEN is missing +INDEXDEN_INDEX = None +INDEXDEN_PRIVATE_URL = None +if not os.environ.has_key('INDEXDEN_INDEX') or \ + not os.environ.has_key('INDEXDEN_PRIVATE_URL'): + MOCK_MODE = True +else: + INDEXDEN_INDEX = os.environ['INDEXDEN_INDEX'] + INDEXDEN_PRIVATE_URL = os.environ['INDEXDEN_PRIVATE_URL'] class SearchResult(object): """The result of making a query into IndexDen. -- 2.25.1