Commit c6954902 by Nimisha Asthagiri

Create courseware/views folder

parent 2f581448
...@@ -298,7 +298,7 @@ class DashboardTest(ModuleStoreTestCase): ...@@ -298,7 +298,7 @@ class DashboardTest(ModuleStoreTestCase):
self.assertIsNone(course_mode_info['days_for_upsell']) self.assertIsNone(course_mode_info['days_for_upsell'])
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@patch('courseware.index.log.warning') @patch('courseware.views.index.log.warning')
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
def test_blocked_course_scenario(self, log_warning): def test_blocked_course_scenario(self, log_warning):
......
...@@ -43,7 +43,7 @@ What is supported: ...@@ -43,7 +43,7 @@ What is supported:
(http://www.imsglobal.org/lti/ltiv2p0/uml/purl.imsglobal.org/vocab/lis/v2/outcomes/Result/service.html) (http://www.imsglobal.org/lti/ltiv2p0/uml/purl.imsglobal.org/vocab/lis/v2/outcomes/Result/service.html)
a.) Discovery of all such LTI http endpoints for a course. External tools GET from this discovery a.) Discovery of all such LTI http endpoints for a course. External tools GET from this discovery
endpoint and receive URLs for interacting with individual grading units. endpoint and receive URLs for interacting with individual grading units.
(see lms/djangoapps/courseware/views.py:get_course_lti_endpoints) (see lms/djangoapps/courseware/views/views.py:get_course_lti_endpoints)
b.) GET, PUT and DELETE in LTI Result JSON binding b.) GET, PUT and DELETE in LTI Result JSON binding
(http://www.imsglobal.org/lti/ltiv2p0/mediatype/application/vnd/ims/lis/v2/result+json/index.html) (http://www.imsglobal.org/lti/ltiv2p0/mediatype/application/vnd/ims/lis/v2/result+json/index.html)
for a provider to synchronize grades into edx-platform. Reading, Setting, and Deleteing for a provider to synchronize grades into edx-platform. Reading, Setting, and Deleteing
......
...@@ -91,7 +91,7 @@ The LMS is a django site, with root in `lms/`. It runs in many different enviro ...@@ -91,7 +91,7 @@ The LMS is a django site, with root in `lms/`. It runs in many different enviro
- `lms/djangoapps/courseware/models.py` - `lms/djangoapps/courseware/models.py`
- Core rendering path: - Core rendering path:
- `lms/urls.py` points to `courseware.views.index`, which gets module info from the course xml file, pulls list of `StudentModule` objects for this user (to avoid multiple db hits). - `lms/urls.py` points to `courseware.views.views.index`, which gets module info from the course xml file, pulls list of `StudentModule` objects for this user (to avoid multiple db hits).
- Calls `render_accordion` to render the "accordion"--the display of the course structure. - Calls `render_accordion` to render the "accordion"--the display of the course structure.
......
...@@ -44,7 +44,7 @@ MOCK_MODULES = [ ...@@ -44,7 +44,7 @@ MOCK_MODULES = [
'courseware.access', 'courseware.access',
'courseware.model_data', 'courseware.model_data',
'courseware.module_render', 'courseware.module_render',
'courseware.views', 'courseware.views.views',
'util.request', 'util.request',
'eventtracking', 'eventtracking',
'xmodule', 'xmodule',
......
...@@ -196,7 +196,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): ...@@ -196,7 +196,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
self.factory = RequestFactory() self.factory = RequestFactory()
@patch('student.views.render_to_response', RENDER_MOCK) @patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK) @patch('courseware.views.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
def test_course_discovery_off(self): def test_course_discovery_off(self):
""" """
...@@ -220,7 +220,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): ...@@ -220,7 +220,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
self.assertIn('<div class="courses no-course-discovery"', response.content) self.assertIn('<div class="courses no-course-discovery"', response.content)
@patch('student.views.render_to_response', RENDER_MOCK) @patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK) @patch('courseware.views.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': True}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': True})
def test_course_discovery_on(self): def test_course_discovery_on(self):
""" """
...@@ -242,7 +242,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): ...@@ -242,7 +242,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
self.assertIn('<div class="courses"', response.content) self.assertIn('<div class="courses"', response.content)
@patch('student.views.render_to_response', RENDER_MOCK) @patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK) @patch('courseware.views.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
def test_course_cards_sorted_by_default_sorting(self): def test_course_cards_sorted_by_default_sorting(self):
response = self.client.get('/') response = self.client.get('/')
...@@ -267,7 +267,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase): ...@@ -267,7 +267,7 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
self.assertEqual(context['courses'][2].id, self.course_with_default_start_date.id) self.assertEqual(context['courses'][2].id, self.course_with_default_start_date.id)
@patch('student.views.render_to_response', RENDER_MOCK) @patch('student.views.render_to_response', RENDER_MOCK)
@patch('courseware.views.render_to_response', RENDER_MOCK) @patch('courseware.views.views.render_to_response', RENDER_MOCK)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_SORTING_BY_START_DATE': False}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_SORTING_BY_START_DATE': False})
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False}) @patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
def test_course_cards_sorted_by_start_date_disabled(self): def test_course_cards_sorted_by_start_date_disabled(self):
......
...@@ -15,7 +15,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage ...@@ -15,7 +15,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage
from edxmako.shortcuts import render_to_response from edxmako.shortcuts import render_to_response
import student.views import student.views
from student.models import CourseEnrollment from student.models import CourseEnrollment
import courseware.views import courseware.views.views
from microsite_configuration import microsite from microsite_configuration import microsite
from edxmako.shortcuts import marketing_link from edxmako.shortcuts import marketing_link
from util.cache import cache_if_anonymous from util.cache import cache_if_anonymous
...@@ -97,7 +97,7 @@ def courses(request): ...@@ -97,7 +97,7 @@ def courses(request):
""" """
Render the "find courses" page. If the marketing site is enabled, redirect Render the "find courses" page. If the marketing site is enabled, redirect
to that. Otherwise, if subdomain branding is on, this is the university to that. Otherwise, if subdomain branding is on, this is the university
profile page. Otherwise, it's the edX courseware.views.courses page profile page. Otherwise, it's the edX courseware.views.views.courses page
""" """
enable_mktg_site = microsite.get_value( enable_mktg_site = microsite.get_value(
'ENABLE_MKTG_SITE', 'ENABLE_MKTG_SITE',
...@@ -112,7 +112,7 @@ def courses(request): ...@@ -112,7 +112,7 @@ def courses(request):
# we do not expect this case to be reached in cases where # we do not expect this case to be reached in cases where
# marketing is enabled or the courses are not browsable # marketing is enabled or the courses are not browsable
return courseware.views.courses(request) return courseware.views.views.courses(request)
def _footer_static_url(request, name): def _footer_static_url(request, name):
......
...@@ -7,7 +7,7 @@ import itertools ...@@ -7,7 +7,7 @@ import itertools
import mock import mock
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
from courseware.views import progress from courseware.views.views import progress
from courseware.field_overrides import OverrideFieldData from courseware.field_overrides import OverrideFieldData
from datetime import datetime from datetime import datetime
from django.conf import settings from django.conf import settings
......
...@@ -983,10 +983,10 @@ class TestCCXGrades(SharedModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -983,10 +983,10 @@ class TestCCXGrades(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEqual(data['HW 03'], '0.25') self.assertEqual(data['HW 03'], '0.25')
self.assertEqual(data['HW Avg'], '0.5') self.assertEqual(data['HW Avg'], '0.5')
@patch('courseware.views.render_to_response', intercept_renderer) @patch('courseware.views.views.render_to_response', intercept_renderer)
def test_student_progress(self): def test_student_progress(self):
self.course.enable_ccx = True self.course.enable_ccx = True
patch_context = patch('courseware.views.get_course_with_access') patch_context = patch('courseware.views.views.get_course_with_access')
get_course = patch_context.start() get_course = patch_context.start()
get_course.return_value = self.course get_course.return_value = self.course
self.addCleanup(patch_context.stop) self.addCleanup(patch_context.stop)
......
...@@ -39,7 +39,7 @@ class BlockSerializer(serializers.Serializer): # pylint: disable=abstract-metho ...@@ -39,7 +39,7 @@ class BlockSerializer(serializers.Serializer): # pylint: disable=abstract-metho
request=self.context['request'], request=self.context['request'],
), ),
'student_view_url': reverse( 'student_view_url': reverse(
'courseware.views.render_xblock', 'courseware.views.views.render_xblock',
kwargs={'usage_key_string': unicode(block_key)}, kwargs={'usage_key_string': unicode(block_key)},
request=self.context['request'], request=self.context['request'],
), ),
......
...@@ -18,7 +18,7 @@ class RedirectUnenrolledMiddleware(object): ...@@ -18,7 +18,7 @@ class RedirectUnenrolledMiddleware(object):
course_key = exception.course_key course_key = exception.course_key
return redirect( return redirect(
reverse( reverse(
'courseware.views.course_about', 'courseware.views.views.course_about',
args=[course_key.to_deprecated_string()] args=[course_key.to_deprecated_string()]
) )
) )
...@@ -28,7 +28,7 @@ from courseware.tests.factories import ( ...@@ -28,7 +28,7 @@ from courseware.tests.factories import (
StaffFactory, StaffFactory,
UserFactory, UserFactory,
) )
import courseware.views as views import courseware.views.views as views
from courseware.tests.helpers import LoginEnrollmentTestCase from courseware.tests.helpers import LoginEnrollmentTestCase
from edxmako.tests import mako_middleware_process_request from edxmako.tests import mako_middleware_process_request
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
......
...@@ -11,7 +11,7 @@ from django.conf import settings ...@@ -11,7 +11,7 @@ from django.conf import settings
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from courseware.tests import BaseTestXmodule from courseware.tests import BaseTestXmodule
from courseware.views import get_course_lti_endpoints from courseware.views.views import get_course_lti_endpoints
from lms.djangoapps.lms_xblock.runtime import quote_slashes from lms.djangoapps.lms_xblock.runtime import quote_slashes
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
......
...@@ -6,7 +6,6 @@ from django.core.urlresolvers import reverse ...@@ -6,7 +6,6 @@ from django.core.urlresolvers import reverse
from django.http import Http404 from django.http import Http404
from mock import MagicMock, Mock, patch from mock import MagicMock, Mock, patch
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.courses import get_course_by_id from courseware.courses import get_course_by_id
from courseware.tabs import ( from courseware.tabs import (
...@@ -15,7 +14,7 @@ from courseware.tabs import ( ...@@ -15,7 +14,7 @@ from courseware.tabs import (
) )
from courseware.tests.helpers import get_request_for_user, LoginEnrollmentTestCase from courseware.tests.helpers import get_request_for_user, LoginEnrollmentTestCase
from courseware.tests.factories import InstructorFactory, StaffFactory from courseware.tests.factories import InstructorFactory, StaffFactory
from courseware.views import get_static_tab_contents, static_tab from courseware.views.views import get_static_tab_contents, static_tab
from student.models import CourseEnrollment from student.models import CourseEnrollment
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from util.milestones_helpers import ( from util.milestones_helpers import (
...@@ -272,7 +271,7 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase): ...@@ -272,7 +271,7 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase):
self.assertIn('static_tab', tab_content) self.assertIn('static_tab', tab_content)
# Test when render raises an exception # Test when render raises an exception
with patch('courseware.views.get_module') as mock_module_render: with patch('courseware.views.views.get_module') as mock_module_render:
mock_module_render.return_value = MagicMock( mock_module_render.return_value = MagicMock(
render=Mock(side_effect=Exception('Render failed!')) render=Mock(side_effect=Exception('Render failed!'))
) )
......
...@@ -26,7 +26,7 @@ from xblock.core import XBlock ...@@ -26,7 +26,7 @@ from xblock.core import XBlock
from xblock.fields import String, Scope from xblock.fields import String, Scope
from xblock.fragment import Fragment from xblock.fragment import Fragment
import courseware.views as views import courseware.views.views as views
import shoppingcart import shoppingcart
from certificates import api as certs_api from certificates import api as certs_api
from certificates.models import CertificateStatuses, CertificateGenerationConfiguration from certificates.models import CertificateStatuses, CertificateGenerationConfiguration
...@@ -34,13 +34,13 @@ from certificates.tests.factories import GeneratedCertificateFactory ...@@ -34,13 +34,13 @@ from certificates.tests.factories import GeneratedCertificateFactory
from commerce.models import CommerceConfiguration from commerce.models import CommerceConfiguration
from course_modes.models import CourseMode from course_modes.models import CourseMode
from course_modes.tests.factories import CourseModeFactory from course_modes.tests.factories import CourseModeFactory
from courseware.index import render_accordion, CoursewareIndex
from courseware.model_data import set_score from courseware.model_data import set_score
from courseware.module_render import toc_for_course from courseware.module_render import toc_for_course
from courseware.testutils import RenderXBlockTestMixin from courseware.testutils import RenderXBlockTestMixin
from courseware.tests.factories import StudentModuleFactory from courseware.tests.factories import StudentModuleFactory
from courseware.url_helpers import get_redirect_url from courseware.url_helpers import get_redirect_url
from courseware.user_state_client import DjangoXBlockUserStateClient from courseware.user_state_client import DjangoXBlockUserStateClient
from courseware.views.index import render_accordion, CoursewareIndex
from edxmako.tests import mako_middleware_process_request from edxmako.tests import mako_middleware_process_request
from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error from lms.djangoapps.commerce.utils import EcommerceService # pylint: disable=import-error
from milestones.tests.utils import MilestonesTestCaseMixin from milestones.tests.utils import MilestonesTestCaseMixin
...@@ -256,7 +256,7 @@ class ViewsTestCase(ModuleStoreTestCase): ...@@ -256,7 +256,7 @@ class ViewsTestCase(ModuleStoreTestCase):
self._verify_index_response(expected_response_code=404, chapter_name='non-existent') self._verify_index_response(expected_response_code=404, chapter_name='non-existent')
def test_index_nonexistent_chapter_masquerade(self): def test_index_nonexistent_chapter_masquerade(self):
with patch('courseware.index.setup_masquerade') as patch_masquerade: with patch('courseware.views.index.setup_masquerade') as patch_masquerade:
masquerade = MagicMock(role='student') masquerade = MagicMock(role='student')
patch_masquerade.return_value = (masquerade, self.user) patch_masquerade.return_value = (masquerade, self.user)
self._verify_index_response(expected_response_code=302, chapter_name='non-existent') self._verify_index_response(expected_response_code=302, chapter_name='non-existent')
...@@ -265,7 +265,7 @@ class ViewsTestCase(ModuleStoreTestCase): ...@@ -265,7 +265,7 @@ class ViewsTestCase(ModuleStoreTestCase):
self._verify_index_response(expected_response_code=404, section_name='non-existent') self._verify_index_response(expected_response_code=404, section_name='non-existent')
def test_index_nonexistent_section_masquerade(self): def test_index_nonexistent_section_masquerade(self):
with patch('courseware.index.setup_masquerade') as patch_masquerade: with patch('courseware.views.index.setup_masquerade') as patch_masquerade:
masquerade = MagicMock(role='student') masquerade = MagicMock(role='student')
patch_masquerade.return_value = (masquerade, self.user) patch_masquerade.return_value = (masquerade, self.user)
self._verify_index_response(expected_response_code=302, section_name='non-existent') self._verify_index_response(expected_response_code=302, section_name='non-existent')
...@@ -1315,7 +1315,7 @@ class GenerateUserCertTests(ModuleStoreTestCase): ...@@ -1315,7 +1315,7 @@ class GenerateUserCertTests(ModuleStoreTestCase):
# status valid code # status valid code
# mocking xqueue and analytics # mocking xqueue and analytics
analytics_patcher = patch('courseware.views.analytics') analytics_patcher = patch('courseware.views.views.analytics')
mock_tracker = analytics_patcher.start() mock_tracker = analytics_patcher.start()
self.addCleanup(analytics_patcher.stop) self.addCleanup(analytics_patcher.stop)
...@@ -1439,7 +1439,7 @@ class ViewCheckerBlock(XBlock): ...@@ -1439,7 +1439,7 @@ class ViewCheckerBlock(XBlock):
@ddt.ddt @ddt.ddt
class TestIndexView(ModuleStoreTestCase): class TestIndexView(ModuleStoreTestCase):
""" """
Tests of the courseware.index view. Tests of the courseware.views.index view.
""" """
@XBlock.register_temp_plugin(ViewCheckerBlock, 'view_checker') @XBlock.register_temp_plugin(ViewCheckerBlock, 'view_checker')
......
...@@ -32,24 +32,24 @@ from xmodule.modulestore.django import modulestore ...@@ -32,24 +32,24 @@ from xmodule.modulestore.django import modulestore
from xmodule.x_module import STUDENT_VIEW from xmodule.x_module import STUDENT_VIEW
from survey.utils import must_answer_survey from survey.utils import must_answer_survey
from .access import has_access, _adjust_start_date_for_beta_testers from ..access import has_access, _adjust_start_date_for_beta_testers
from .access_utils import in_preview_mode from ..access_utils import in_preview_mode
from .courses import get_studio_url, get_course_with_access from ..courses import get_studio_url, get_course_with_access
from .entrance_exams import ( from ..entrance_exams import (
course_has_entrance_exam, course_has_entrance_exam,
get_entrance_exam_content, get_entrance_exam_content,
get_entrance_exam_score, get_entrance_exam_score,
user_has_passed_entrance_exam, user_has_passed_entrance_exam,
user_must_complete_entrance_exam, user_must_complete_entrance_exam,
) )
from .exceptions import Redirect from ..exceptions import Redirect
from .masquerade import setup_masquerade from ..masquerade import setup_masquerade
from .model_data import FieldDataCache from ..model_data import FieldDataCache
from .module_render import toc_for_course, get_module_for_descriptor from ..module_render import toc_for_course, get_module_for_descriptor
from .views import get_current_child, registered_for_course from .views import get_current_child, registered_for_course
log = logging.getLogger("edx.courseware.index") log = logging.getLogger("edx.courseware.views.index")
TEMPLATE_IMPORTS = {'urllib': urllib} TEMPLATE_IMPORTS = {'urllib': urllib}
CONTENT_DEPTH = 2 CONTENT_DEPTH = 2
...@@ -187,8 +187,8 @@ class CoursewareIndex(View): ...@@ -187,8 +187,8 @@ class CoursewareIndex(View):
Verifies that the user can enter the course. Verifies that the user can enter the course.
""" """
self._redirect_if_needed_to_pay_for_course() self._redirect_if_needed_to_pay_for_course()
self._redirect_if_needed_to_register_for_course() self._redirect_if_needed_to_register()
self._redirect_if_needed_for_course_prerequisites() self._redirect_if_needed_for_prereqs()
self._redirect_if_needed_for_course_survey() self._redirect_if_needed_for_course_survey()
def _redirect_if_needed_to_pay_for_course(self): def _redirect_if_needed_to_pay_for_course(self):
...@@ -211,7 +211,7 @@ class CoursewareIndex(View): ...@@ -211,7 +211,7 @@ class CoursewareIndex(View):
) )
raise Redirect(reverse('dashboard')) raise Redirect(reverse('dashboard'))
def _redirect_if_needed_to_register_for_course(self): def _redirect_if_needed_to_register(self):
""" """
Verify that the user is registered in the course. Verify that the user is registered in the course.
""" """
...@@ -223,7 +223,7 @@ class CoursewareIndex(View): ...@@ -223,7 +223,7 @@ class CoursewareIndex(View):
) )
raise Redirect(reverse('about_course', args=[unicode(self.course.id)])) raise Redirect(reverse('about_course', args=[unicode(self.course.id)]))
def _redirect_if_needed_for_course_prerequisites(self): def _redirect_if_needed_for_prereqs(self):
""" """
See if all pre-requisites (as per the milestones app feature) have been See if all pre-requisites (as per the milestones app feature) have been
fulfilled. Note that if the pre-requisite feature flag has been turned off fulfilled. Note that if the pre-requisite feature flag has been turned off
......
...@@ -68,7 +68,6 @@ from openedx.core.djangoapps.credit.api import ( ...@@ -68,7 +68,6 @@ from openedx.core.djangoapps.credit.api import (
is_credit_course is_credit_course
) )
from openedx.core.djangoapps.theming import helpers as theming_helpers from openedx.core.djangoapps.theming import helpers as theming_helpers
from shoppingcart.models import CourseRegistrationCode
from shoppingcart.utils import is_shopping_cart_enabled from shoppingcart.utils import is_shopping_cart_enabled
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from student.models import UserTestGroup, CourseEnrollment from student.models import UserTestGroup, CourseEnrollment
...@@ -83,8 +82,8 @@ from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem ...@@ -83,8 +82,8 @@ from xmodule.modulestore.exceptions import ItemNotFoundError, NoPathToItem
from xmodule.tabs import CourseTabList from xmodule.tabs import CourseTabList
from xmodule.x_module import STUDENT_VIEW from xmodule.x_module import STUDENT_VIEW
from lms.djangoapps.ccx.custom_exception import CCXLocatorValidationException from lms.djangoapps.ccx.custom_exception import CCXLocatorValidationException
from .entrance_exams import user_must_complete_entrance_exam from ..entrance_exams import user_must_complete_entrance_exam
from .module_render import get_module_for_descriptor, get_module, get_module_by_usage_id from ..module_render import get_module_for_descriptor, get_module, get_module_by_usage_id
log = logging.getLogger("edx.courseware") log = logging.getLogger("edx.courseware")
...@@ -107,13 +106,13 @@ def user_groups(user): ...@@ -107,13 +106,13 @@ def user_groups(user):
cache_expiration = 60 * 60 # one hour cache_expiration = 60 * 60 # one hour
# Kill caching on dev machines -- we switch groups a lot # Kill caching on dev machines -- we switch groups a lot
group_names = cache.get(key) group_names = cache.get(key) # pylint: disable=no-member
if settings.DEBUG: if settings.DEBUG:
group_names = None group_names = None
if group_names is None: if group_names is None:
group_names = [u.name for u in UserTestGroup.objects.filter(users=user)] group_names = [u.name for u in UserTestGroup.objects.filter(users=user)]
cache.set(key, group_names, cache_expiration) cache.set(key, group_names, cache_expiration) # pylint: disable=no-member
return group_names return group_names
......
...@@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _ ...@@ -21,7 +21,7 @@ from django.utils.translation import ugettext as _
from edxnotes.exceptions import EdxNotesParseError, EdxNotesServiceUnavailable from edxnotes.exceptions import EdxNotesParseError, EdxNotesServiceUnavailable
from edxnotes.plugins import EdxNotesTab from edxnotes.plugins import EdxNotesTab
from courseware.views import get_current_child from courseware.views.views import get_current_child
from courseware.access import has_access from courseware.access import has_access
from openedx.core.lib.token_utils import get_id_token from openedx.core.lib.token_utils import get_id_token
from student.models import anonymous_id_for_user from student.models import anonymous_id_for_user
......
...@@ -142,7 +142,7 @@ def render_courseware(request, usage_key): ...@@ -142,7 +142,7 @@ def render_courseware(request, usage_key):
context to render the courseware. context to render the courseware.
""" """
# return an HttpResponse object that contains the template and necessary context to render the courseware. # return an HttpResponse object that contains the template and necessary context to render the courseware.
from courseware.views import render_xblock from courseware.views.views import render_xblock
return render_xblock(request, unicode(usage_key), check_if_enrolled=False) return render_xblock(request, unicode(usage_key), check_if_enrolled=False)
......
...@@ -15,8 +15,8 @@ from opaque_keys import InvalidKeyError ...@@ -15,8 +15,8 @@ from opaque_keys import InvalidKeyError
from courseware.access import is_mobile_available_for_user from courseware.access import is_mobile_available_for_user
from courseware.model_data import FieldDataCache from courseware.model_data import FieldDataCache
from courseware.module_render import get_module_for_descriptor from courseware.module_render import get_module_for_descriptor
from courseware.index import save_positions_recursively_up from courseware.views.index import save_positions_recursively_up
from courseware.views import get_current_child from courseware.views.views import get_current_child
from student.models import CourseEnrollment, User from student.models import CourseEnrollment, User
from xblock.fields import Scope from xblock.fields import Scope
......
...@@ -12,7 +12,7 @@ from microsite_configuration import microsite ...@@ -12,7 +12,7 @@ from microsite_configuration import microsite
import auth_exchange.views import auth_exchange.views
from config_models.views import ConfigurationModelCurrentAPIView from config_models.views import ConfigurationModelCurrentAPIView
from courseware.index import CoursewareIndex from courseware.views.index import CoursewareIndex
from openedx.core.djangoapps.programs.models import ProgramsApiConfig from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
...@@ -271,14 +271,14 @@ urlpatterns += ( ...@@ -271,14 +271,14 @@ urlpatterns += (
r'^courses/{}/jump_to/(?P<location>.*)$'.format( r'^courses/{}/jump_to/(?P<location>.*)$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.jump_to', 'courseware.views.views.jump_to',
name='jump_to', name='jump_to',
), ),
url( url(
r'^courses/{}/jump_to_id/(?P<module_id>.*)$'.format( r'^courses/{}/jump_to_id/(?P<module_id>.*)$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.jump_to_id', 'courseware.views.views.jump_to_id',
name='jump_to_id', name='jump_to_id',
), ),
...@@ -318,7 +318,7 @@ urlpatterns += ( ...@@ -318,7 +318,7 @@ urlpatterns += (
# Note: This is not an API. Compare this with the xblock_view API above. # Note: This is not an API. Compare this with the xblock_view API above.
url( url(
r'^xblock/{usage_key_string}$'.format(usage_key_string=settings.USAGE_KEY_PATTERN), r'^xblock/{usage_key_string}$'.format(usage_key_string=settings.USAGE_KEY_PATTERN),
'courseware.views.render_xblock', 'courseware.views.views.render_xblock',
name='render_xblock', name='render_xblock',
), ),
...@@ -362,7 +362,7 @@ urlpatterns += ( ...@@ -362,7 +362,7 @@ urlpatterns += (
r'^courses/{}/about$'.format( r'^courses/{}/about$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.course_about', 'courseware.views.views.course_about',
name='about_course', name='about_course',
), ),
...@@ -371,14 +371,14 @@ urlpatterns += ( ...@@ -371,14 +371,14 @@ urlpatterns += (
r'^courses/{}/$'.format( r'^courses/{}/$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.course_info', 'courseware.views.views.course_info',
name='course_root', name='course_root',
), ),
url( url(
r'^courses/{}/info$'.format( r'^courses/{}/info$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.course_info', 'courseware.views.views.course_info',
name='info', name='info',
), ),
# TODO arjun remove when custom tabs in place, see courseware/courses.py # TODO arjun remove when custom tabs in place, see courseware/courses.py
...@@ -386,7 +386,7 @@ urlpatterns += ( ...@@ -386,7 +386,7 @@ urlpatterns += (
r'^courses/{}/syllabus$'.format( r'^courses/{}/syllabus$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.syllabus', 'courseware.views.views.syllabus',
name='syllabus', name='syllabus',
), ),
...@@ -395,7 +395,7 @@ urlpatterns += ( ...@@ -395,7 +395,7 @@ urlpatterns += (
r'^courses/{}/survey$'.format( r'^courses/{}/survey$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.course_survey', 'courseware.views.views.course_survey',
name='course_survey', name='course_survey',
), ),
...@@ -492,7 +492,7 @@ urlpatterns += ( ...@@ -492,7 +492,7 @@ urlpatterns += (
r'^courses/{}/progress$'.format( r'^courses/{}/progress$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.progress', 'courseware.views.views.progress',
name='progress', name='progress',
), ),
# Takes optional student_id for instructor use--shows profile as that student sees it. # Takes optional student_id for instructor use--shows profile as that student sees it.
...@@ -500,7 +500,7 @@ urlpatterns += ( ...@@ -500,7 +500,7 @@ urlpatterns += (
r'^courses/{}/progress/(?P<student_id>[^/]*)/$'.format( r'^courses/{}/progress/(?P<student_id>[^/]*)/$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.progress', 'courseware.views.views.progress',
name='student_progress', name='student_progress',
), ),
...@@ -632,7 +632,7 @@ urlpatterns += ( ...@@ -632,7 +632,7 @@ urlpatterns += (
r'^courses/{}/lti_rest_endpoints/'.format( r'^courses/{}/lti_rest_endpoints/'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.get_course_lti_endpoints', 'courseware.views.views.get_course_lti_endpoints',
name='lti_rest_endpoints', name='lti_rest_endpoints',
), ),
...@@ -697,7 +697,7 @@ urlpatterns += ( ...@@ -697,7 +697,7 @@ urlpatterns += (
r'^courses/{}/generate_user_cert'.format( r'^courses/{}/generate_user_cert'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.generate_user_cert', 'courseware.views.views.generate_user_cert',
name='generate_user_cert', name='generate_user_cert',
), ),
) )
...@@ -750,7 +750,7 @@ urlpatterns += ( ...@@ -750,7 +750,7 @@ urlpatterns += (
r'^courses/{}/(?P<tab_slug>[^/]+)/$'.format( r'^courses/{}/(?P<tab_slug>[^/]+)/$'.format(
settings.COURSE_ID_PATTERN, settings.COURSE_ID_PATTERN,
), ),
'courseware.views.static_tab', 'courseware.views.views.static_tab',
name='static_tab', name='static_tab',
), ),
) )
...@@ -761,7 +761,7 @@ if settings.FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW'): ...@@ -761,7 +761,7 @@ if settings.FEATURES.get('ENABLE_STUDENT_HISTORY_VIEW'):
r'^courses/{}/submission_history/(?P<student_username>[^/]*)/(?P<location>.*?)$'.format( r'^courses/{}/submission_history/(?P<student_username>[^/]*)/(?P<location>.*?)$'.format(
settings.COURSE_ID_PATTERN settings.COURSE_ID_PATTERN
), ),
'courseware.views.submission_history', 'courseware.views.views.submission_history',
name='submission_history', name='submission_history',
), ),
) )
...@@ -994,17 +994,17 @@ if settings.FEATURES.get('ENABLE_FINANCIAL_ASSISTANCE_FORM'): ...@@ -994,17 +994,17 @@ if settings.FEATURES.get('ENABLE_FINANCIAL_ASSISTANCE_FORM'):
urlpatterns += ( urlpatterns += (
url( url(
r'^financial-assistance/$', r'^financial-assistance/$',
'courseware.views.financial_assistance', 'courseware.views.views.financial_assistance',
name='financial_assistance' name='financial_assistance'
), ),
url( url(
r'^financial-assistance/apply/$', r'^financial-assistance/apply/$',
'courseware.views.financial_assistance_form', 'courseware.views.views.financial_assistance_form',
name='financial_assistance_form' name='financial_assistance_form'
), ),
url( url(
r'^financial-assistance/submit/$', r'^financial-assistance/submit/$',
'courseware.views.financial_assistance_request', 'courseware.views.views.financial_assistance_request',
name='submit_financial_assistance_request' name='submit_financial_assistance_request'
) )
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment