mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
refactor: simplify is_active / core_module logic
This commit is contained in:
@@ -70,9 +70,11 @@ class EventPluginSignal(django.dispatch.Signal):
|
||||
|
||||
# Find the Django application this belongs to
|
||||
searchpath = receiver.__module__
|
||||
core_module = any([searchpath.startswith(cm) for cm in settings.CORE_MODULES])
|
||||
app = None
|
||||
if not core_module:
|
||||
|
||||
# Core modules are always active
|
||||
if any(searchpath.startswith(cm) for cm in settings.CORE_MODULES):
|
||||
return True
|
||||
|
||||
while True:
|
||||
app = app_cache.get(searchpath)
|
||||
if "." not in searchpath or app:
|
||||
@@ -81,7 +83,7 @@ class EventPluginSignal(django.dispatch.Signal):
|
||||
|
||||
# Only fire receivers from active plugins and core modules
|
||||
excluded = settings.PRETIX_PLUGINS_EXCLUDE
|
||||
if core_module or (sender and app and app.name in sender.get_plugins() and app.name not in excluded):
|
||||
if sender and app and app.name in sender.get_plugins() and app.name not in excluded:
|
||||
if not hasattr(app, 'compatibility_errors') or not app.compatibility_errors:
|
||||
return True
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user