Skip to content

Commit

Permalink
Merge pull request #39 from openedx/bmtcril/embedded_locale_uuid_fix
Browse files Browse the repository at this point in the history
fix: Normalize localized asset UUIDs
  • Loading branch information
bmtcril authored Apr 30, 2024
2 parents 9a54231 + 3a6779a commit 139f453
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Unreleased

*

0.7.3 - 2024-04-30
******************

Fixed
=====

* Fixed UUID generation for localized Superset assets, which caused embedded
dashboards to fail to load when localized.

0.7.2 - 2024-04-19
******************

Expand Down
2 changes: 1 addition & 1 deletion platform_plugin_aspects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import os
from pathlib import Path

__version__ = "0.7.2"
__version__ = "0.7.3"

ROOT_DIRECTORY = Path(os.path.dirname(os.path.abspath(__file__)))
10 changes: 6 additions & 4 deletions platform_plugin_aspects/extensions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ def run_filter(
user = get_current_user()

user_language = (
get_model("user_preference").get_value(user, "pref-lang") or "en_US"
get_model("user_preference").get_value(user, "pref-lang") or "en"
)
formatted_language = user_language.replace("-", "_")
if formatted_language not in settings.SUPERSET_DASHBOARD_LOCALES:
formatted_language = "en_US"
formatted_language = user_language.lower().replace("-", "_")
if formatted_language not in [
loc.lower().replace("-", "_") for loc in settings.SUPERSET_DASHBOARD_LOCALES
]:
formatted_language = "en"

context["course_id"] = course.id
context = generate_superset_context(
Expand Down
2 changes: 1 addition & 1 deletion platform_plugin_aspects/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def plugin_settings(settings):
},
]
settings.SUPERSET_EXTRA_FILTERS_FORMAT = []
settings.SUPERSET_DASHBOARD_LOCALES = ["en_US"]
settings.SUPERSET_DASHBOARD_LOCALES = ["en"]
settings.EVENT_SINK_CLICKHOUSE_BACKEND_CONFIG = {
# URL to a running ClickHouse server's HTTP interface. ex: https://foo.openedx.org:8443/ or
# http://foo.openedx.org:8123/ . Note that we only support the ClickHouse HTTP interface
Expand Down
3 changes: 2 additions & 1 deletion platform_plugin_aspects/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,5 @@ def get_localized_uuid(base_uuid, language):
"""
base_uuid = uuid.UUID(base_uuid)
base_namespace = uuid.uuid5(base_uuid, "superset")
return str(uuid.uuid5(base_namespace, language))
normalized_language = language.lower().replace("-", "_")
return str(uuid.uuid5(base_namespace, normalized_language))

0 comments on commit 139f453

Please sign in to comment.