Skip to content

Commit

Permalink
fix!: use full import path to safe_lxml (#324)
Browse files Browse the repository at this point in the history
Previously, edx-platform's safe_lxml module was imported as:

  import safe_lxml

This still works, but will stop working very soon.

This commit updates edx-sga's usage of safe_lxml to the new,
correct import path:

  import openedx.core.lib.safe_lxml

(Details & reasoning behind this import path change:
  * https://discuss.openedx.org/t/breaking-apart-edx-platforms-common-lib-folder/7556
  * https://openedx.atlassian.net/browse/BOM-2579)

This change is NOT backwards-compatible with Nutmeg or earlier.
  • Loading branch information
kdmccormick authored Sep 8, 2022
1 parent 1af4a5c commit 8897a14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion edx_sga/sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from django.utils.timezone import now as django_now
from django.utils.translation import gettext as _
from lms.djangoapps.courseware.models import StudentModule
from safe_lxml import etree
from openedx.core.lib.safe_lxml import etree
from common.djangoapps.student.models import user_by_anonymous_id
from submissions import api as submissions_api
from submissions.models import StudentItem as SubmissionsStudent
Expand Down
2 changes: 1 addition & 1 deletion edx_sga/tests/test_sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def fake_import(name, *args, **kwargs):
for module in ("common", "courseware", "lms", "xmodule"):
if name.startswith(f"{module}.") or name == module:
return mock.Mock()
if name == "safe_lxml":
if name == "openedx.core.lib.safe_lxml":
return real_import("lxml", *args, **kwargs)
raise

Expand Down

0 comments on commit 8897a14

Please sign in to comment.