Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.core.management.base import BaseCommand, CommandError
from xblock.fields import Date

from cms.djangoapps.contentstore.management.commands.utils import user_from_str
from cms.djangoapps.contentstore.views.course import create_new_course_in_store
from openedx.core.djangoapps.credit.models import CreditProvider
from xmodule.course_block import CourseFields # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.fields import Date # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.exceptions import DuplicateCourseError # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.tabs import CourseTabList # lint-amnesty, pylint: disable=wrong-import-order

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from rest_framework.fields import Field as SerializerField
from xblock.fields import (
Boolean,
Date,
DateTime,
Dict,
Field as XBlockField,
Expand All @@ -15,7 +16,6 @@
String,
)
from xmodule.course_block import CourseFields, EmailString
from xmodule.fields import Date

from cms.djangoapps.models.settings.course_metadata import CourseMetadata

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/tests/test_course_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from milestones.models import MilestoneRelationshipType
from milestones.tests.utils import MilestonesTestCaseMixin
from pytz import UTC
from xblock.fields import Date

from cms.djangoapps.contentstore import toggles
from cms.djangoapps.contentstore.utils import reverse_course_url, reverse_usage_url
Expand All @@ -49,7 +50,6 @@
)
from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.lib.teams_config import TeamsConfig
from xmodule.fields import Date # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order

Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/views/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
from rest_framework.request import Request
from web_fragments.fragment import Fragment
from xblock.django.request import django_to_webob_request, webob_to_django_response
from xblock.exceptions import NoSuchHandlerError
from xblock.exceptions import NoSuchHandlerError, NotFoundError, ProcessingError
from xblock.runtime import KvsFieldData

from openedx.core.djangoapps.video_config.services import VideoConfigService
from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError, ProcessingError
from xmodule.exceptions import NotFoundError as XModuleNotFoundError
from xmodule.modulestore.django import XBlockI18nService, modulestore
from xmodule.partitions.partitions_service import PartitionService
from xmodule.services import SettingsService, TeamsConfigurationService
Expand Down Expand Up @@ -81,7 +81,7 @@ def preview_handler(request, usage_key_string, handler, suffix=''):
log.exception("XBlock %s attempted to access missing handler %r", instance, handler)
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from

except NotFoundError:
except (XModuleNotFoundError, NotFoundError):
log.exception("Module indicating to user that request doesn't exist")
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/models/settings/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from json.encoder import JSONEncoder

from opaque_keys.edx.locations import Location
from xblock.fields import Date

from openedx.core.djangoapps.models.course_details import CourseDetails
from xmodule.fields import Date # lint-amnesty, pylint: disable=wrong-import-order

from .course_grading import CourseGradingModel

Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/course_home_api/progress/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.contrib.auth import get_user_model
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.grade_utils import round_away_from_zero
from xmodule.graders import ShowCorrectness
from xblock.scorable import ShowCorrectness
from datetime import datetime, timezone

from lms.djangoapps.courseware.courses import get_course_blocks_completion_summary
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/course_home_api/progress/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from unittest.mock import patch

from django.test import TestCase
from xblock.scorable import ShowCorrectness

from lms.djangoapps.course_home_api.progress.api import (
calculate_progress_for_learner_in_course,
aggregate_assignment_type_grade_summary,
)
from xmodule.graders import ShowCorrectness
from datetime import datetime, timedelta, timezone
from types import SimpleNamespace

Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/course_home_api/progress/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from rest_framework.generics import RetrieveAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from xblock.scorable import ShowCorrectness

from xmodule.modulestore.django import modulestore
from xmodule.graders import ShowCorrectness
from common.djangoapps.student.models import CourseEnrollment
from lms.djangoapps.course_home_api.progress.serializers import ProgressTabSerializer
from lms.djangoapps.course_home_api.progress.api import aggregate_assignment_type_grade_summary
Expand Down
6 changes: 3 additions & 3 deletions lms/djangoapps/courseware/block_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
from typing import Callable, TYPE_CHECKING
from web_fragments.fragment import Fragment
from xblock.django.request import django_to_webob_request, webob_to_django_response
from xblock.exceptions import NoSuchHandlerError, NoSuchViewError
from xblock.exceptions import NoSuchHandlerError, NoSuchViewError, NotFoundError, ProcessingError
from xblock.reference.plugins import FSService
from xblock.runtime import KvsFieldData

from lms.djangoapps.teams.services import TeamsService
from openedx.core.djangoapps.video_config.services import VideoConfigService
from openedx.core.lib.xblock_services.call_to_action import CallToActionService
from xmodule.contentstore.django import contentstore
from xmodule.exceptions import NotFoundError, ProcessingError
from xmodule.exceptions import NotFoundError as XModuleNotFoundError
from xmodule.library_tools import LegacyLibraryToolsService
from xmodule.modulestore.django import XBlockI18nService, modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
Expand Down Expand Up @@ -966,7 +966,7 @@ def _invoke_xblock_handler(request, course_id, usage_id, handler, suffix, course
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from

# If we can't find the block, respond with a 404
except NotFoundError:
except (XModuleNotFoundError, NotFoundError):
log.exception("Module indicating to user that request doesn't exist")
raise Http404 # lint-amnesty, pylint: disable=raise-missing-from

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def move_overrides_to_edx_when(apps, schema_editor):
from xmodule.fields import Date
from xblock.fields import Date
from edx_when import api
date_field = Date()
StudentFieldOverride = apps.get_model('courseware', 'StudentFieldOverride')
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/courseware/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from xblock.fields import Scope, String
from xblock.scorable import ShowCorrectness
from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory
from xmodule.data import CertificatesDisplayBehaviors
from xmodule.graders import ShowCorrectness
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import CourseUserType, ModuleStoreTestCase, SharedModuleStoreTestCase
Expand Down
3 changes: 2 additions & 1 deletion lms/djangoapps/grades/subsection_grade.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
from datetime import datetime, timezone
from logging import getLogger
from lazy import lazy
from xblock.scorable import ShowCorrectness

from lms.djangoapps.grades.models import BlockRecord, PersistentSubsectionGrade
from lms.djangoapps.grades.scores import compute_percent, get_score, possibly_scored
from xmodule import block_metadata_utils, graders # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.graders import AggregatedScore, ShowCorrectness # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.graders import AggregatedScore # lint-amnesty, pylint: disable=wrong-import-order

log = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from opaque_keys.edx.locator import UsageKey
from pytz import UTC
from testfixtures import LogCapture
from xblock.fields import Date

from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
Expand Down Expand Up @@ -102,7 +103,6 @@
from openedx.core.lib.teams_config import TeamsConfig
from openedx.core.lib.xblock_utils import grade_histogram
from openedx.features.course_experience import RELATIVE_DATES_FLAG
from xmodule.fields import Date
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import (
TEST_DATA_SPLIT_MODULESTORE,
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/instructor/tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from edx_when.field_data import DateLookupFieldData
from opaque_keys.edx.keys import CourseKey
from pytz import UTC
from xmodule.fields import Date
from xblock.fields import Date
from xmodule.modulestore.tests.django_utils import (
TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase, SharedModuleStoreTestCase,
)
Expand Down
2 changes: 1 addition & 1 deletion lms/templates/courseware/progress.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
from urllib.parse import quote_plus
from django.utils.translation import gettext as _
from pytz import UTC
from xblock.scorable import ShowCorrectness

from common.djangoapps.course_modes.models import CourseMode
from lms.djangoapps.certificates.data import CertificateStatuses
from lms.djangoapps.grades.api import constants as grades_constants
from openedx.core.djangolib.markup import HTML, Text
from openedx.features.enterprise_support.utils import get_enterprise_learner_generic_name
from xmodule.graders import ShowCorrectness
%>

<%
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/models/course_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import re

from django.conf import settings
from xblock.fields import Date

from openedx.core.djangolib.markup import HTML
from openedx.core.lib.courses import course_image_url
from xmodule.data import CertificatesDisplayBehaviors # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.fields import Date # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order

Expand Down
23 changes: 17 additions & 6 deletions xmodule/capa_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,23 @@
from pytz import utc
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from xblock.fields import Boolean, Dict, Float, Integer, List, Scope, String, XMLString
from xblock.scorable import ScorableXBlockMixin, Score
from xblock.exceptions import NotFoundError, ProcessingError
from xblock.fields import (
Boolean,
Date,
Dict,
Float,
Integer,
List,
ListScoreField,
Scope,
ScoreField,
String,
Timedelta,
XMLString
)
from xblock.progress import Progress
from xblock.scorable import ScorableXBlockMixin, Score, ShowCorrectness
from xblocks_contrib.problem import ProblemBlock as _ExtractedProblemBlock

from common.djangoapps.xblock_django.constants import (
Expand All @@ -42,17 +57,13 @@
from xmodule.capa.util import convert_files_to_filenames, get_inner_html_from_xpath
from xmodule.contentstore.django import contentstore
from xmodule.editing_block import EditingMixin
from xmodule.exceptions import NotFoundError, ProcessingError
from xmodule.graders import ShowCorrectness
from xmodule.raw_block import RawMixin
from xmodule.util.builtin_assets import add_css_to_fragment, add_webpack_js_to_fragment
from xmodule.util.sandboxing import SandboxService
from xmodule.x_module import ResourceTemplates, XModuleMixin, XModuleToXBlockMixin, shim_xmodule_js
from xmodule.xml_block import XmlMixin

from .capa.xqueue_interface import XQueueService
from .fields import Date, ListScoreField, ScoreField, Timedelta
from .progress import Progress

log = logging.getLogger("edx.courseware")

Expand Down
3 changes: 1 addition & 2 deletions xmodule/course_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from lxml import etree
from path import Path as path
from pytz import utc
from xblock.fields import Boolean, Dict, Float, Integer, List, Scope, String
from xblock.fields import Boolean, Date, Dict, Float, Integer, List, Scope, String
from openedx.core.djangoapps.video_pipeline.models import VideoUploadsEnabledByDefault
from openedx.core.djangoapps.video_config.sharing import (
COURSE_VIDEO_SHARING_ALL_VIDEOS,
Expand All @@ -32,7 +32,6 @@
from xmodule.seq_block import SequenceBlock
from xmodule.tabs import CourseTabList, InvalidTabsException

from .fields import Date
from .modulestore.exceptions import InvalidProctoringProvider

log = logging.getLogger(__name__)
Expand Down
8 changes: 0 additions & 8 deletions xmodule/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ class NotFoundError(Exception):
pass


class ProcessingError(Exception):
'''
An error occurred while processing a request to the XModule.
For example: if an exception occurs while checking a capa problem.
'''
pass # lint-amnesty, pylint: disable=unnecessary-pass


class InvalidVersionError(Exception):
"""
Tried to save an item with a location that a store cannot support (e.g., draft version
Expand Down
Loading
Loading