Enable Carbasa webshop templates for Oscar

This commit is contained in:
2026-04-26 09:53:31 +02:00
parent 59a1cd3c16
commit 0c735f2b69

View File

@@ -21,6 +21,7 @@ BASE_DIR = str(BASE_PATH)
setup_search_paths("/etc/ocyan/", str(_project_app_path))
from ocyan.main.settings import * # pylint:disable=W0401,W0614
from ocyan.core.fender import config as ocyan_config
INSTALLED_APPS = [
"mandelblog_content_guard.apps.MandelblogContentGuardConfig",
@@ -60,6 +61,21 @@ _ensure_required_app(
"ocyan.plugin.coyote",
)
def _ensure_installed_app(app_label: str, *, before: str | None = None) -> None:
"""Ensure an app is present in INSTALLED_APPS with optional ordering."""
if app_label in INSTALLED_APPS:
INSTALLED_APPS.remove(app_label)
if before and before in INSTALLED_APPS:
INSTALLED_APPS.insert(INSTALLED_APPS.index(before), app_label)
else:
INSTALLED_APPS.append(app_label)
# Prefer Carbasa's webshop templates whenever this project runs as a webshop.
# Ensures the full Carbasa webshop header (search, user bar, cart, megamenu).
if ocyan_config.is_webshop and importlib.util.find_spec("ocyan.plugin.carbasa.webshop"):
_ensure_installed_app("ocyan.plugin.carbasa.webshop", before="ocyan.plugin.carbasa")
# Keep Carbasa/Coyote defaults stable even when plugin settings are not
# injected early enough during startup on this deployment.
OXYAN_HEADER_OPTIONS = globals().get(