Skip to content

Commit

Permalink
Merge pull request #610 from open-craft/artur/xblock-preview-fs-service
Browse files Browse the repository at this point in the history
fix: make "fs" service available in XBlock preview module system
  • Loading branch information
ArturGaspar committed Jan 17, 2024
2 parents 4f73576 + b726cd2 commit bc82fe7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
8 changes: 7 additions & 1 deletion cms/djangoapps/contentstore/views/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,16 @@ def _preview_module_system(request, descriptor, field_data):
descriptor: An XModuleDescriptor
"""

# Import is placed here to avoid model import at project startup.
import xblock.reference.plugins

course_id = descriptor.location.course_key
display_name_only = (descriptor.category == 'static_tab')

replace_url_service = ReplaceURLService(course_id=course_id)

fs_service = xblock.reference.plugins.FSService()

wrappers = [
# This wrapper wraps the block in the template specified above
partial(
Expand Down Expand Up @@ -229,7 +234,8 @@ def _preview_module_system(request, descriptor, field_data):
"teams_configuration": TeamsConfigurationService(),
"sandbox": SandboxService(contentstore=contentstore, course_id=course_id),
"cache": CacheService(cache),
'replace_urls': replace_url_service
'replace_urls': replace_url_service,
"fs": fs_service
},
)

Expand Down
3 changes: 2 additions & 1 deletion requirements/edx/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ unicodecsv # Easier support for CSV files with unicode
user-util # Functionality for retiring users (GDPR compliance)
webob
web-fragments # Provides the ability to render fragments of web pages
XBlock[django] # Courseware component architecture
# Using OpenCraft fork of XBlock in github.in
#XBlock[django] # Courseware component architecture
xblock-utils # Provides utilities used by the Discussion XBlock
xss-utils # https://github.com/edx/edx-platform/pull/20633 Fix XSS via Translations
xblock-poll # Xblock for polling users
Expand Down
10 changes: 6 additions & 4 deletions requirements/edx/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,10 @@ openedx-blockstore==1.3.1
# via -r requirements/edx/base.in
openedx-calc==3.0.1
# via -r requirements/edx/base.in
openedx-django-pyfs==3.2.1
# via xblock
openedx-django-pyfs @ git+https://github.com/open-craft/django-pyfs.git@opencraft-release/3.5.0-tox-3
# via
# -r requirements/edx/github.in
# xblock
openedx-django-require==2.0.0
# via -r requirements/edx/base.in
openedx-django-wiki==2.0.0
Expand Down Expand Up @@ -1170,9 +1172,9 @@ wrapt==1.15.0
# via
# -r requirements/edx/paver.txt
# deprecated
xblock[django]==1.6.2
xblock @ git+https://github.com/open-craft/XBlock.git@opencraft-release/1.6.2
# via
# -r requirements/edx/base.in
# -r requirements/edx/github.in
# acid-xblock
# crowdsourcehinter-xblock
# done-xblock
Expand Down
11 changes: 4 additions & 7 deletions requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ edx-django-release-util==1.2.0
# openedx-blockstore
edx-django-sites-extensions==4.0.0
# via -r requirements/edx/testing.txt
edx-django-utils==5.2.0
edx-django-utils==5.3.0
# via
# -r requirements/edx/testing.txt
# django-config-models
Expand Down Expand Up @@ -890,7 +890,6 @@ lazy==1.5
# bok-choy
# lti-consumer-xblock
# ora2
# xblock
lazy-object-proxy==1.9.0
# via
# -r requirements/edx/testing.txt
Expand Down Expand Up @@ -1019,10 +1018,8 @@ openedx-blockstore==1.3.1
# via -r requirements/edx/testing.txt
openedx-calc==3.0.1
# via -r requirements/edx/testing.txt
openedx-django-pyfs==3.2.1
# via
# -r requirements/edx/testing.txt
# xblock
openedx-django-pyfs @ git+https://github.com/open-craft/django-pyfs.git@opencraft-release/3.5.0-tox-3
# via -r requirements/edx/testing.txt
openedx-django-require==2.0.0
# via -r requirements/edx/testing.txt
openedx-django-wiki==2.0.0
Expand Down Expand Up @@ -1699,7 +1696,7 @@ wrapt==1.15.0
# -r requirements/edx/testing.txt
# astroid
# deprecated
xblock[django]==1.6.2
xblock @ git+https://github.com/open-craft/XBlock.git@opencraft-release/1.6.2
# via
# -r requirements/edx/testing.txt
# acid-xblock
Expand Down
5 changes: 4 additions & 1 deletion requirements/edx/github.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@
# Critical fixes for packages that are not yet available in a PyPI release.
##############################################################################

# ... add dependencies here
# https://github.com/open-craft/XBlock/pull/6
git+https://github.com/open-craft/XBlock.git@opencraft-release/1.6.2#egg=XBlock[django]==1.6.2
# https://github.com/openedx/django-pyfs/pull/169
git+https://github.com/open-craft/django-pyfs.git@opencraft-release/3.5.0-tox-3#egg=openedx-django-pyfs==3.5.0


##############################################################################
Expand Down
11 changes: 4 additions & 7 deletions requirements/edx/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ edx-django-release-util==1.2.0
# openedx-blockstore
edx-django-sites-extensions==4.0.0
# via -r requirements/edx/base.txt
edx-django-utils==5.2.0
edx-django-utils==5.3.0
# via
# -r requirements/edx/base.txt
# django-config-models
Expand Down Expand Up @@ -846,7 +846,6 @@ lazy==1.5
# bok-choy
# lti-consumer-xblock
# ora2
# xblock
lazy-object-proxy==1.9.0
# via astroid
learner-pathway-progress==1.3.3
Expand Down Expand Up @@ -966,10 +965,8 @@ openedx-blockstore==1.3.1
# via -r requirements/edx/base.txt
openedx-calc==3.0.1
# via -r requirements/edx/base.txt
openedx-django-pyfs==3.2.1
# via
# -r requirements/edx/base.txt
# xblock
openedx-django-pyfs @ git+https://github.com/open-craft/django-pyfs.git@opencraft-release/3.5.0-tox-3
# via -r requirements/edx/base.txt
openedx-django-require==2.0.0
# via -r requirements/edx/base.txt
openedx-django-wiki==2.0.0
Expand Down Expand Up @@ -1567,7 +1564,7 @@ wrapt==1.15.0
# -r requirements/edx/base.txt
# astroid
# deprecated
xblock[django]==1.6.2
xblock @ git+https://github.com/open-craft/XBlock.git@opencraft-release/1.6.2
# via
# -r requirements/edx/base.txt
# acid-xblock
Expand Down

0 comments on commit bc82fe7

Please sign in to comment.