Permalink
Browse files

Fixed a raise condition when using the simple backend (e.g. in tests)…

… and changing the DEBUG setting dynamically (e.g. in integration tests).
  • Loading branch information...
1 parent 33e3217 commit 66f4157c0f676b421c202b0239a80800091c717c @jezdez jezdez committed Feb 22, 2012
Showing with 5 additions and 4 deletions.
  1. +5 −4 haystack/backends/simple_backend.py
View
9 haystack/backends/simple_backend.py
@@ -24,19 +24,20 @@ def emit(self, record):
logger.setLevel(logging.WARNING)
logger.addHandler(NullHandler())
logger.addHandler(ch)
-
+else:
+ logger = None
class SimpleSearchBackend(BaseSearchBackend):
def update(self, indexer, iterable, commit=True):
- if settings.DEBUG:
+ if logger is not None:
logger.warning('update is not implemented in this backend')
def remove(self, obj, commit=True):
- if settings.DEBUG:
+ if logger is not None:
logger.warning('remove is not implemented in this backend')
def clear(self, models=[], commit=True):
- if settings.DEBUG:
+ if logger is not None:
logger.warning('clear is not implemented in this backend')
@log_query

0 comments on commit 66f4157

Please sign in to comment.