From 403577ab4581da57c99bd16534388492a5cbd797 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Thu, 7 Jul 2022 18:13:16 -0400 Subject: [PATCH] fix!: use full import path to safe_lxml 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. --- edx_sga/sga.py | 2 +- edx_sga/tests/test_sga.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/edx_sga/sga.py b/edx_sga/sga.py index 152b644e..a59dc202 100644 --- a/edx_sga/sga.py +++ b/edx_sga/sga.py @@ -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 diff --git a/edx_sga/tests/test_sga.py b/edx_sga/tests/test_sga.py index c91181f2..5f59138c 100644 --- a/edx_sga/tests/test_sga.py +++ b/edx_sga/tests/test_sga.py @@ -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