mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
refactor: simplify is_active / core_module logic
This commit is contained in:
@@ -70,18 +70,20 @@ class EventPluginSignal(django.dispatch.Signal):
|
|||||||
|
|
||||||
# Find the Django application this belongs to
|
# Find the Django application this belongs to
|
||||||
searchpath = receiver.__module__
|
searchpath = receiver.__module__
|
||||||
core_module = any([searchpath.startswith(cm) for cm in settings.CORE_MODULES])
|
|
||||||
app = None
|
# Core modules are always active
|
||||||
if not core_module:
|
if any(searchpath.startswith(cm) for cm in settings.CORE_MODULES):
|
||||||
while True:
|
return True
|
||||||
app = app_cache.get(searchpath)
|
|
||||||
if "." not in searchpath or app:
|
while True:
|
||||||
break
|
app = app_cache.get(searchpath)
|
||||||
searchpath, _ = 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
|
||||||
excluded = settings.PRETIX_PLUGINS_EXCLUDE
|
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:
|
if not hasattr(app, 'compatibility_errors') or not app.compatibility_errors:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user