Fix detection of core modules after ae910eb7

This commit is contained in:
Raphael Michel
2017-07-13 20:33:08 +02:00
parent 5a8042cc10
commit d644b8fe01
2 changed files with 12 additions and 10 deletions

View File

@@ -45,15 +45,17 @@ class EventPluginSignal(django.dispatch.Signal):
for receiver in self._live_receivers(sender): for receiver in self._live_receivers(sender):
# Find the Django application this belongs to # Find the Django application this belongs to
searchpath = receiver.__module__ searchpath = receiver.__module__
mod = None core_module = any([searchpath.startswith(cm) for cm in settings.CORE_MODULES])
while True: app = None
app = app_cache.get(searchpath) if not core_module:
if "." not in searchpath or app: while True:
break app = app_cache.get(searchpath)
searchpath, mod = searchpath.rsplit(".", 1) if "." not in searchpath or app:
break
searchpath, _ = searchpath.rsplit(".", 1)
# Only fire receivers from active plugins and core modules # 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: if not hasattr(app, 'compatibility_errors') or not app.compatibility_errors:
response = receiver(signal=self, sender=sender, **named) response = receiver(signal=self, sender=sender, **named)
responses.append((receiver, response)) responses.append((receiver, response))

View File

@@ -257,9 +257,9 @@ REST_FRAMEWORK = {
CORE_MODULES = { CORE_MODULES = {
("pretix", "base"), "pretix.base",
("pretix", "presale"), "pretix.presale",
("pretix", "control") "pretix.control"
} }
MIDDLEWARE = [ MIDDLEWARE = [