Commit f99343cf authored by Daniel Klaffenbach's avatar Daniel Klaffenbach 🐍

get_journal_entry_username(): Check for MIDDLEWARE and MIDDLEWARE_CLASSES

parent 5d70fbb3
......@@ -247,11 +247,12 @@ def get_journal_entry_username(self):
try:
return getattr(_thread_local_storage, 'model_journal_username')
except AttributeError:
if 'model_journal.middleware.ModelJournalMiddleware' not in settings.MIDDLEWARE_CLASSES:
if 'model_journal.middleware.ModelJournalMiddleware' not in getattr(settings, 'MIDDLEWARE_CLASSES', []) and \
'model_journal.middleware.ModelJournalMiddleware' not in getattr(settings, 'MIDDLEWARE', []):
raise ImproperlyConfigured(
"The ModelJournalMiddleware is missing from your MIDDLEWARE_CLASSES"
)
else:
username = getuser()
logger.debug("Using current system user (%s) for ModelJournal logging." %username)
logger.debug("Using current system user (%s) for ModelJournal logging." % username)
return username
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment