add python getter in capa system
This commit is contained in:
@@ -7,7 +7,7 @@ from django.test.utils import override_settings
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import CourseLocator, LibraryLocator
|
||||
|
||||
from util.sandboxing import can_execute_unsafe_code
|
||||
from xmodule.util.sandboxing import can_execute_unsafe_code
|
||||
|
||||
|
||||
class SandboxingTest(TestCase):
|
||||
|
||||
@@ -11,7 +11,9 @@ import dogstats_wrapper as dog_stats_api
|
||||
from capa import responsetypes
|
||||
from xmodule.exceptions import NotFoundError, ProcessingError
|
||||
from xmodule.raw_module import RawDescriptor
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.util.misc import escape_html_characters
|
||||
from xmodule.util.sandboxing import get_python_lib_zip
|
||||
from xmodule.x_module import DEPRECATION_VSCOMPAT_EVENT, XModule, module_attr
|
||||
|
||||
from .capa_base import CapaFields, CapaMixin, ComplexEncoder
|
||||
@@ -331,7 +333,6 @@ class CapaDescriptor(CapaFields, RawDescriptor):
|
||||
if limit_responses == 0:
|
||||
# Don't even start collecting answers
|
||||
return
|
||||
|
||||
capa_system = LoncapaSystem(
|
||||
ajax_url=None,
|
||||
# TODO set anonymous_student_id to the anonymous ID of the user which answered each problem
|
||||
@@ -341,7 +342,7 @@ class CapaDescriptor(CapaFields, RawDescriptor):
|
||||
anonymous_student_id=None,
|
||||
cache=None,
|
||||
can_execute_unsafe_code=lambda: None,
|
||||
get_python_lib_zip=lambda: None,
|
||||
get_python_lib_zip=(lambda: get_python_lib_zip(contentstore, self.runtime.course_id)),
|
||||
DEBUG=None,
|
||||
filestore=self.runtime.resources_fs,
|
||||
i18n=self.runtime.service(self, "i18n"),
|
||||
|
||||
@@ -28,7 +28,7 @@ from openedx.core.djangoapps.request_cache.middleware import RequestCache
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.draft_and_published import BranchSettingMixin
|
||||
from xmodule.modulestore.mixed import MixedModuleStore
|
||||
from xmodule.util.django import get_current_request_hostname
|
||||
from xmodule.util.xmodule_django import get_current_request_hostname
|
||||
|
||||
# We also may not always have the current request user (crum) module available
|
||||
try:
|
||||
|
||||
@@ -271,7 +271,7 @@ class ModuleStoreIsolationMixin(CacheIsolationMixin, SignalIsolationMixin):
|
||||
|
||||
# List of modulestore signals enabled for this test. Defaults to an empty
|
||||
# list. The list of signals available is found on the SignalHandler class,
|
||||
# in /common/lib/xmodule/xmodule/modulestore/django.py
|
||||
# in /common/lib/xmodule/xmodule/modulestore/xmodule_django.py
|
||||
#
|
||||
# You must use the signal itself, and not its name. So for example:
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""Tests for methods defined in util/django.py"""
|
||||
from xmodule.util.django import get_current_request, get_current_request_hostname
|
||||
from xmodule.util.xmodule_django import get_current_request, get_current_request_hostname
|
||||
from nose.tools import assert_is_none
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from lms.djangoapps.dashboard.git_import import DEFAULT_PYTHON_LIB_FILENAME
|
||||
|
||||
DEFAULT_PYTHON_LIB_FILENAME = 'python_lib.zip'
|
||||
|
||||
|
||||
def can_execute_unsafe_code(course_id):
|
||||
Reference in New Issue
Block a user