indexden is now optional master
authorBryan <btbonval@gmail.com>
Mon, 17 Aug 2015 00:36:36 +0000 (20:36 -0400)
committerBryan <btbonval@gmail.com>
Mon, 17 Aug 2015 00:36:36 +0000 (20:36 -0400)
closes #443

karmaworld/apps/notes/search.py

index fd944aff6b014b1e615197942373efb263524916..d912e28cef2f6cbfd0cab9798d1fb7f275ff5bbd 100644 (file)
@@ -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.