add python getter in capa system

This commit is contained in:
noraiz-anwar
2018-07-13 11:03:05 +05:00
parent 7f1f3b0dad
commit 593c2d1ae8
13 changed files with 15 additions and 14 deletions

View File

@@ -3,10 +3,10 @@ Script for importing courseware from XML format
"""
from django.core.management.base import BaseCommand
from django_comment_common.utils import are_permissions_roles_seeded, seed_permissions_roles
from lms.djangoapps.dashboard.git_import import DEFAULT_PYTHON_LIB_FILENAME
from xmodule.contentstore.django import contentstore
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.util.sandboxing import DEFAULT_PYTHON_LIB_FILENAME
from xmodule.modulestore.xml_importer import import_course_from_xml

View File

@@ -1149,7 +1149,7 @@ class CourseMetadataEditingTest(CourseTestCase):
self.assertEqual(tab_list, course.tabs)
@patch.dict(settings.FEATURES, {'ENABLE_EDXNOTES': True})
@patch('xmodule.util.django.get_current_request')
@patch('xmodule.util.xmodule_django.get_current_request')
def test_post_settings_with_staff_not_enrolled(self, mock_request):
"""
Tests that we can post advance settings when course staff is not enrolled.

View File

@@ -29,7 +29,7 @@ from openedx.core.lib.xblock_utils import (
wrap_xblock_aside,
xblock_local_resource_url
)
from util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
from xmodule.util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
from xblock_config.models import StudioConfig
from xblock_django.user_service import DjangoXBlockUserService
from xmodule.contentstore.django import contentstore

View File

@@ -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):

View File

@@ -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"),

View File

@@ -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:

View File

@@ -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:
#

View File

@@ -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

View File

@@ -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):

View File

@@ -13,7 +13,7 @@ from courseware.access_response import AccessResponse, StartDateError
from courseware.masquerade import is_masquerading_as_student
from openedx.features.course_experience import COURSE_PRE_START_ACCESS_FLAG
from student.roles import CourseBetaTesterRole
from xmodule.util.django import get_current_request_hostname
from xmodule.util.xmodule_django import get_current_request_hostname
DEBUG_ACCESS = False
log = getLogger(__name__)

View File

@@ -69,7 +69,7 @@ from track import contexts
from util import milestones_helpers
from util.json_request import JsonResponse
from django.utils.text import slugify
from util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
from xmodule.util.sandboxing import can_execute_unsafe_code, get_python_lib_zip
from xblock_django.user_service import DjangoXBlockUserService
from xmodule.contentstore.django import contentstore
from xmodule.error_module import ErrorDescriptor, NonStaffErrorDescriptor

View File

@@ -15,6 +15,7 @@ from django.core import management
from django.core.management.base import CommandError
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from xmodule.util.sandboxing import DEFAULT_PYTHON_LIB_FILENAME
from opaque_keys.edx.keys import CourseKey
from dashboard.models import CourseImportLog
@@ -22,7 +23,6 @@ from dashboard.models import CourseImportLog
log = logging.getLogger(__name__)
DEFAULT_GIT_REPO_DIR = '/edx/var/app/edxapp/course_repos'
DEFAULT_PYTHON_LIB_FILENAME = 'python_lib.zip'
class GitImportError(Exception):