From: Bryan Date: Mon, 17 Aug 2015 00:36:36 +0000 (-0400) Subject: indexden is now optional X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=HEAD;p=oweals%2Fkarmaworld.git indexden is now optional closes #443 --- 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.