From d700f130a2ade2d777c40c3d0780a8e137b4f857 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Fri, 22 Dec 2023 23:48:16 +0300 Subject: [PATCH] fix: add missing ``xblock`` parameter in `get_javascript_i18n_catalog_url` To match the Open edX LMS XBlockI18nService in test environments. --- CHANGELOG.rst | 6 ++++++ xblock/__init__.py | 2 +- xblock/runtime.py | 5 ++++- xblock/test/test_runtime.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e7f082a34..7c81085e9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,12 @@ These are notable changes in XBlock. Unreleased ---------- +1.9.1 - 2023-12-22 +------------------ + +* Fix: add ``get_javascript_i18n_catalog_url`` missing ``xblock`` parameter to match the Open edX LMS + XBlockI18nService. + 1.9.0 - 2023-11-20 ------------------ diff --git a/xblock/__init__.py b/xblock/__init__.py index e230e9dc9..564ce3837 100644 --- a/xblock/__init__.py +++ b/xblock/__init__.py @@ -27,4 +27,4 @@ def __init__(self, *args, **kwargs): # without causing a circular import xblock.fields.XBlockMixin = XBlockMixin -__version__ = '1.9.0' +__version__ = '1.9.1' diff --git a/xblock/runtime.py b/xblock/runtime.py index d9f9efd86..05e8af10a 100644 --- a/xblock/runtime.py +++ b/xblock/runtime.py @@ -1357,10 +1357,13 @@ def strftime(self, dtime, format): # pylint: disable=redefined-builtin timestring = dtime.strftime(format) return timestring - def get_javascript_i18n_catalog_url(self): + def get_javascript_i18n_catalog_url(self, block): # pylint: disable=unused-argument """ Return the URL to the JavaScript i18n catalog file. + Args: + block (XBlock): The block that is requesting the URL. + This method returns None in NullI18nService. When implemented in a runtime, it should return the URL to the JavaScript i18n catalog so it can be loaded in frontends. diff --git a/xblock/test/test_runtime.py b/xblock/test/test_runtime.py index d02bf02e9..60e6fb170 100644 --- a/xblock/test/test_runtime.py +++ b/xblock/test/test_runtime.py @@ -524,7 +524,7 @@ def assert_equals_unicode(str1, str2): assert_equals_unicode("10:30:17 PM", i18n.strftime(when, "TIME")) # Runtimes are expected to implement this method though. - assert i18n.get_javascript_i18n_catalog_url() is None, 'NullI18nService does not implement this method.' + assert i18n.get_javascript_i18n_catalog_url(object()) is None, 'NullI18nService does not implement this method.' # secret_service is available. assert self.runtime.service(self, "secret_service") == 17