Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoBessel authored Apr 19, 2024
2 parents 554aa6a + 2ae4557 commit 1247703
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 25 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Change history for XBlock
Unreleased
----------

4.0.0 - 2024-04-18
------------------

* xblock.fragment has returned as a pass-though component to web_fragments.fragment


3.0.0 - 2024-03-18
------------------
Expand All @@ -15,7 +20,7 @@ will be unaffected by this change. Some improvements have also been made to the

Specific changes:

* **Removed:**
* **Removed:**

* ``xblock.XBlockMixin`` (still available as ``xblock.core.XBlockMixin``)
* ``xblock.core.SharedBlockBase`` (replaced with ``xblock.core.Blocklike``)
Expand Down Expand Up @@ -53,7 +58,7 @@ Specific changes:

* Various docstrings have been improved, some of which are published in the docs.
* XBlockAside will now be represented in the API docs, right below XBlock on the "XBlock API" page.
* XBlockMixin has been removed from the docs.
* XBlockMixin has been removed from the docs.
It was only ever documented under the "Fields API" page (which didn't make any sense),
and it was barely even documented there. We considered adding it back to the "XBlock API" page,
but as noted in the class's new docstring, we do not want to encourage any new use of XBlockMixin.
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/base.in
mako==1.3.2
mako==1.3.3
# via -r requirements/base.in
markupsafe==2.1.5
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ coverage==7.4.4
# via -r requirements/ci.in
distlib==0.3.8
# via virtualenv
filelock==3.13.3
filelock==3.13.4
# via
# tox
# virtualenv
Expand Down
10 changes: 5 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -r requirements/test.txt
# django
boto3==1.34.80
boto3==1.34.84
# via
# -r requirements/test.txt
# fs-s3fs
botocore==1.34.80
botocore==1.34.84
# via
# -r requirements/test.txt
# boto3
Expand Down Expand Up @@ -103,7 +103,7 @@ exceptiongroup==1.2.0
# -r requirements/test.txt
# hypothesis
# pytest
filelock==3.13.3
filelock==3.13.4
# via
# -r requirements/ci.txt
# -r requirements/test.txt
Expand Down Expand Up @@ -160,7 +160,7 @@ lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/test.txt
mako==1.3.2
mako==1.3.3
# via -r requirements/test.txt
markupsafe==2.1.5
# via
Expand Down Expand Up @@ -290,7 +290,7 @@ sortedcontainers==2.4.0
# via
# -r requirements/test.txt
# hypothesis
sqlparse==0.4.4
sqlparse==0.5.0
# via
# -r requirements/test.txt
# django
Expand Down
8 changes: 4 additions & 4 deletions requirements/django.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -r requirements/django.in
# django
boto3==1.34.80
boto3==1.34.84
# via fs-s3fs
botocore==1.34.80
botocore==1.34.84
# via
# boto3
# s3transfer
Expand Down Expand Up @@ -44,7 +44,7 @@ lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
mako==1.3.2
mako==1.3.3
# via -r requirements/base.txt
markupsafe==2.1.5
# via
Expand Down Expand Up @@ -78,7 +78,7 @@ six==1.16.0
# fs
# fs-s3fs
# python-dateutil
sqlparse==0.4.4
sqlparse==0.5.0
# via django
stevedore==5.2.0
# via
Expand Down
10 changes: 5 additions & 5 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ backports-zoneinfo==0.2.1 ; python_version < "3.9"
# django
beautifulsoup4==4.12.3
# via pydata-sphinx-theme
boto3==1.34.80
boto3==1.34.84
# via
# -r requirements/django.txt
# fs-s3fs
botocore==1.34.80
botocore==1.34.84
# via
# -r requirements/django.txt
# boto3
Expand Down Expand Up @@ -59,7 +59,7 @@ fs-s3fs==1.1.1
# via
# -r requirements/django.txt
# openedx-django-pyfs
idna==3.6
idna==3.7
# via requests
imagesize==1.4.1
# via sphinx
Expand All @@ -80,7 +80,7 @@ lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/django.txt
mako==1.3.2
mako==1.3.3
# via -r requirements/django.txt
markupsafe==2.1.5
# via
Expand Down Expand Up @@ -157,7 +157,7 @@ sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sqlparse==0.4.4
sqlparse==0.5.0
# via
# -r requirements/django.txt
# django
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ wheel==0.43.0
# The following packages are considered to be unsafe in a requirements file:
pip==24.0
# via -r requirements/pip.in
setuptools==69.2.0
setuptools==69.5.1
# via -r requirements/pip.in
10 changes: 5 additions & 5 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -r requirements/django.txt
# django
boto3==1.34.80
boto3==1.34.84
# via
# -r requirements/django.txt
# fs-s3fs
botocore==1.34.80
botocore==1.34.84
# via
# -r requirements/django.txt
# boto3
Expand Down Expand Up @@ -73,7 +73,7 @@ exceptiongroup==1.2.0
# via
# hypothesis
# pytest
filelock==3.13.3
filelock==3.13.4
# via
# tox
# virtualenv
Expand Down Expand Up @@ -116,7 +116,7 @@ lxml==4.9.4
# via
# -c requirements/constraints.txt
# -r requirements/django.txt
mako==1.3.2
mako==1.3.3
# via -r requirements/django.txt
markupsafe==2.1.5
# via
Expand Down Expand Up @@ -213,7 +213,7 @@ six==1.16.0
# python-dateutil
sortedcontainers==2.4.0
# via hypothesis
sqlparse==0.4.4
sqlparse==0.5.0
# via
# -r requirements/django.txt
# django
Expand Down
2 changes: 1 addition & 1 deletion xblock/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
XBlock Courseware Components
"""

__version__ = '3.1.0'
__version__ = '4.0.0'
25 changes: 25 additions & 0 deletions xblock/fragment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Makes the Fragment class available through the old namespace location.
"""
import warnings

import web_fragments.fragment


class Fragment(web_fragments.fragment.Fragment):
"""
A wrapper around web_fragments.fragment.Fragment that provides
backwards compatibility for the old location.
Deprecated.
"""
def __init__(self, *args, **kwargs):
warnings.warn(
'xblock.fragment is deprecated. Please use web_fragments.fragment instead',
DeprecationWarning,
stacklevel=2
)
super().__init__(*args, **kwargs)

# Provide older names for renamed methods
add_frag_resources = web_fragments.fragment.Fragment.add_fragment_resources
add_frags_resources = web_fragments.fragment.Fragment.add_resources
21 changes: 21 additions & 0 deletions xblock/test/test_fragment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
Unit tests for the Fragment class.
Note: this class has been deprecated in favor of web_fragments.fragment.Fragment
"""
from unittest import TestCase

from xblock.fragment import Fragment


class TestFragment(TestCase):
"""
Unit tests for fragments.
"""
def test_fragment(self):
"""
Test the delegated Fragment class.
"""
TEST_HTML = '<p>Hello, world!</p>' # pylint: disable=invalid-name
fragment = Fragment()
fragment.add_content(TEST_HTML)
self.assertEqual(fragment.body_html(), TEST_HTML)

0 comments on commit 1247703

Please sign in to comment.