Skip to content

Commit

Permalink
Merge pull request #702 from Zeit-Labs/missing-param
Browse files Browse the repository at this point in the history
fix: add missing ``xblock`` parameter in `get_javascript_i18n_catalog_url` | FC-0012
  • Loading branch information
feanil committed Jan 3, 2024
2 parents 5a95582 + d700f13 commit 73032b9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------

Expand Down
2 changes: 1 addition & 1 deletion xblock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 4 additions & 1 deletion xblock/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion xblock/test/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 73032b9

Please sign in to comment.