File tree 4 files changed +54
-3
lines changed
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
5
5
Unreleased
6
6
----------
7
7
8
+ 4.0.0 - 2024-04-18
9
+ ------------------
10
+
11
+ * xblock.fragment has returned as a pass-though component to web_fragments.fragment
12
+
8
13
9
14
3.0.0 - 2024-03-18
10
15
------------------
@@ -15,7 +20,7 @@ will be unaffected by this change. Some improvements have also been made to the
15
20
16
21
Specific changes:
17
22
18
- * **Removed: **
23
+ * **Removed: **
19
24
20
25
* ``xblock.XBlockMixin `` (still available as ``xblock.core.XBlockMixin ``)
21
26
* ``xblock.core.SharedBlockBase `` (replaced with ``xblock.core.Blocklike ``)
@@ -53,7 +58,7 @@ Specific changes:
53
58
54
59
* Various docstrings have been improved, some of which are published in the docs.
55
60
* 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.
57
62
It was only ever documented under the "Fields API" page (which didn't make any sense),
58
63
and it was barely even documented there. We considered adding it back to the "XBlock API" page,
59
64
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 2
2
XBlock Courseware Components
3
3
"""
4
4
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