Skip to content

Commit

Permalink
fix: gate the content libraries URLs with FEATURES['ENABLE_CONTENT_LI…
Browse files Browse the repository at this point in the history
…BRARIES']

Can't use waffle flags in urls because there's no database access there.
  • Loading branch information
pomegranited committed Oct 17, 2024
1 parent 1b09f94 commit 8cab2d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/views/tests/test_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_library_creator_status_with_no_course_creator_role_and_disabled_nonstaf
self.assertEqual(get_response.status_code, 200)
self.assertEqual(post_response.status_code, 403)

@mock.patch("cms.djangoapps.contentstore.toggles.libraries_v1_enabled", False)
@override_settings(FEATURES={'ENABLE_CONTENT_LIBRARIES': False})
def test_with_libraries_disabled(self):
"""
The library URLs should return 404 if libraries are disabled.
Expand Down
2 changes: 1 addition & 1 deletion cms/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
path('openassessment/fileupload/', include('openassessment.fileupload.urls')),
]

if toggles.libraries_v1_enabled():
if settings.FEATURES.get('ENABLE_CONTENT_LIBRARIES'):
urlpatterns += [
re_path(fr'^library/{LIBRARY_KEY_PATTERN}?$',
contentstore_views.library_handler, name='library_handler'),
Expand Down

0 comments on commit 8cab2d3

Please sign in to comment.