mistercrunch commented on code in PR #35220:
URL: https://github.com/apache/superset/pull/35220#discussion_r2371360772
##########
superset/views/base.py:
##########
@@ -311,66 +311,76 @@ def menu_data(user: User) -> dict[str, Any]:
}
+# Determine if themes need to fall back to base themes
+# A theme needs fallback if it's None or empty
+def should_use_base(theme: dict[str, Any] | None) -> bool:
+ """Check if a theme should be replaced with base theme entirely"""
+ if theme is None or theme == {}:
+ return True
+
+ return False
+
+
+def _load_theme_from_model(
+ theme_model: Any | None, fallback_theme: dict[str, Any] | None,
theme_type: str
+) -> dict[str, Any] | None:
+ """Load and parse theme from database model, with fallback to config
theme."""
+ if theme_model:
+ try:
+ return json.loads(theme_model.json_data)
+ except json.JSONDecodeError:
+ logger.error(
+ "Invalid JSON in system %s theme %s", theme_type,
theme_model.id
+ )
+ return fallback_theme
+ return fallback_theme
+
+
+def _process_theme(theme: dict[str, Any] | None, theme_type: str) -> dict[str,
Any]:
Review Comment:
superset/themes/types.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]