From d644b8fe013c476161ed33886c587b72d1255b4c Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 13 Jul 2017 20:33:08 +0200 Subject: [PATCH] Fix detection of core modules after ae910eb7 --- src/pretix/base/signals.py | 16 +++++++++------- src/pretix/settings.py | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pretix/base/signals.py b/src/pretix/base/signals.py index 6486087f7..b6a0bb471 100644 --- a/src/pretix/base/signals.py +++ b/src/pretix/base/signals.py @@ -45,15 +45,17 @@ class EventPluginSignal(django.dispatch.Signal): for receiver in self._live_receivers(sender): # Find the Django application this belongs to searchpath = receiver.__module__ - mod = None - while True: - app = app_cache.get(searchpath) - if "." not in searchpath or app: - break - searchpath, mod = searchpath.rsplit(".", 1) + core_module = any([searchpath.startswith(cm) for cm in settings.CORE_MODULES]) + app = None + if not core_module: + while True: + app = app_cache.get(searchpath) + if "." not in searchpath or app: + break + searchpath, _ = searchpath.rsplit(".", 1) # Only fire receivers from active plugins and core modules - if (searchpath, mod) in settings.CORE_MODULES or (sender and app and app.name in sender.get_plugins()): + if core_module or (sender and app and app.name in sender.get_plugins()): if not hasattr(app, 'compatibility_errors') or not app.compatibility_errors: response = receiver(signal=self, sender=sender, **named) responses.append((receiver, response)) diff --git a/src/pretix/settings.py b/src/pretix/settings.py index de24f22bc..1f7ff42de 100644 --- a/src/pretix/settings.py +++ b/src/pretix/settings.py @@ -257,9 +257,9 @@ REST_FRAMEWORK = { CORE_MODULES = { - ("pretix", "base"), - ("pretix", "presale"), - ("pretix", "control") + "pretix.base", + "pretix.presale", + "pretix.control" } MIDDLEWARE = [