File tree Expand file tree Collapse file tree 4 files changed +54
-3
lines changed
Expand file tree Collapse file tree 4 files changed +54
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,11 @@ Change history for XBlock
55Unreleased
66----------
77
8+ 4.0.0 - 2024-04-18
9+ ------------------
10+
11+ * xblock.fragment has returned as a pass-though component to web_fragments.fragment
12+
813
9143.0.0 - 2024-03-18
1015------------------
@@ -15,7 +20,7 @@ will be unaffected by this change. Some improvements have also been made to the
1520
1621Specific changes:
1722
18- * **Removed: **
23+ * **Removed: **
1924
2025 * ``xblock.XBlockMixin `` (still available as ``xblock.core.XBlockMixin ``)
2126 * ``xblock.core.SharedBlockBase `` (replaced with ``xblock.core.Blocklike ``)
@@ -53,7 +58,7 @@ Specific changes:
5358
5459 * Various docstrings have been improved, some of which are published in the docs.
5560 * XBlockAside will now be represented in the API docs, right below XBlock on the "XBlock API" page.
56- * XBlockMixin has been removed from the docs.
61+ * XBlockMixin has been removed from the docs.
5762 It was only ever documented under the "Fields API" page (which didn't make any sense),
5863 and it was barely even documented there. We considered adding it back to the "XBlock API" page,
5964 but as noted in the class's new docstring, we do not want to encourage any new use of XBlockMixin.
Original file line number Diff line number Diff line change 22XBlock Courseware Components
33"""
44
5- __version__ = '3.1 .0'
5+ __version__ = '4.0 .0'
Original file line number Diff line number Diff line change 1+ """
2+ Makes the Fragment class available through the old namespace location.
3+ """
4+ import warnings
5+
6+ import web_fragments .fragment
7+
8+
9+ class Fragment (web_fragments .fragment .Fragment ):
10+ """
11+ A wrapper around web_fragments.fragment.Fragment that provides
12+ backwards compatibility for the old location.
13+ Deprecated.
14+ """
15+ def __init__ (self , * args , ** kwargs ):
16+ warnings .warn (
17+ 'xblock.fragment is deprecated. Please use web_fragments.fragment instead' ,
18+ DeprecationWarning ,
19+ stacklevel = 2
20+ )
21+ super ().__init__ (* args , ** kwargs )
22+
23+ # Provide older names for renamed methods
24+ add_frag_resources = web_fragments .fragment .Fragment .add_fragment_resources
25+ add_frags_resources = web_fragments .fragment .Fragment .add_resources
Original file line number Diff line number Diff line change 1+ """
2+ Unit tests for the Fragment class.
3+ Note: this class has been deprecated in favor of web_fragments.fragment.Fragment
4+ """
5+ from unittest import TestCase
6+
7+ from xblock .fragment import Fragment
8+
9+
10+ class TestFragment (TestCase ):
11+ """
12+ Unit tests for fragments.
13+ """
14+ def test_fragment (self ):
15+ """
16+ Test the delegated Fragment class.
17+ """
18+ TEST_HTML = '<p>Hello, world!</p>' # pylint: disable=invalid-name
19+ fragment = Fragment ()
20+ fragment .add_content (TEST_HTML )
21+ self .assertEqual (fragment .body_html (), TEST_HTML )
You can’t perform that action at this time.
0 commit comments