Пример #1
0
 def test_marketing_link(self):
     # test marketing site on
     with patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_MKTG_SITE": True}):
         expected_link = "dummy-root/about-us"
         link = marketing_link("ABOUT")
         self.assertEquals(link, expected_link)
     # test marketing site off
     with patch.dict("django.conf.settings.MITX_FEATURES", {"ENABLE_MKTG_SITE": False}):
         # we are using login because it is common across both cms and lms
         expected_link = reverse("login")
         link = marketing_link("ABOUT")
         self.assertEquals(link, expected_link)
Пример #2
0
 def test_marketing_link(self):
     # test marketing site on
     with patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}):
         expected_link = 'dummy-root/about-us'
         link = marketing_link('ABOUT')
         self.assertEquals(link, expected_link)
     # test marketing site off
     with patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': False}):
         # we are using login because it is common across both cms and lms
         expected_link = reverse('login')
         link = marketing_link('ABOUT')
         self.assertEquals(link, expected_link)
Пример #3
0
 def test_marketing_link(self):
     # test marketing site on
     with patch.dict('django.conf.settings.MITX_FEATURES',
                     {'ENABLE_MKTG_SITE': True}):
         expected_link = 'dummy-root/about-us'
         link = marketing_link('ABOUT')
         self.assertEquals(link, expected_link)
     # test marketing site off
     with patch.dict('django.conf.settings.MITX_FEATURES',
                     {'ENABLE_MKTG_SITE': False}):
         # we are using login because it is common across both cms and lms
         expected_link = reverse('login')
         link = marketing_link('ABOUT')
         self.assertEquals(link, expected_link)
Пример #4
0
def courses(request):
    """
    Render the "find courses" page. If the marketing site is enabled, redirect
    to that. Otherwise, if subdomain branding is on, this is the university
    profile page. Otherwise, it's the edX courseware.views.courses page
    """
    if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
        return redirect(marketing_link('COURSES'), permanent=True)

    university = branding.get_university(request.META.get('HTTP_HOST'))
    if university is None:
        return courseware.views.courses(request)

    return redirect('/')
Пример #5
0
def courses(request):
    """
    Render the "find courses" page. If the marketing site is enabled, redirect
    to that. Otherwise, if subdomain branding is on, this is the university
    profile page. Otherwise, it's the edX courseware.views.courses page
    """
    if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
        return redirect(marketing_link('COURSES'), permanent=True)

    university = branding.get_university(request.META.get('HTTP_HOST'))
    if university is None:
        return courseware.views.courses(request)

    return courseware.views.university_profile(request, university)
Пример #6
0
def courses(request):
    """
    Render the "find courses" page. If the marketing site is enabled, redirect
    to that. Otherwise, if subdomain branding is on, this is the university
    profile page. Otherwise, it's the edX courseware.views.courses page
    """
    if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
        return redirect(marketing_link('COURSES'), permanent=True)

    if not settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'):
        raise Http404

    #  we do not expect this case to be reached in cases where
    #  marketing is enabled or the courses are not browsable
    return courseware.views.courses(request)
Пример #7
0
def courses(request):
    """
    Render the "find courses" page. If the marketing site is enabled, redirect
    to that. Otherwise, if subdomain branding is on, this is the university
    profile page. Otherwise, it's the edX courseware.views.courses page
    """
    if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
        return redirect(marketing_link('COURSES'), permanent=True)

    if not settings.MITX_FEATURES.get('COURSES_ARE_BROWSABLE'):        
        raise Http404

    #  we do not expect this case to be reached in cases where
    #  marketing is enabled or the courses are not browsable
    return courseware.views.courses(request)
Пример #8
0
def courses(request):
    """
    Render the "find courses" page. If the marketing site is enabled, redirect
    to that. Otherwise, if subdomain branding is on, this is the university
    profile page. Otherwise, it's the edX courseware.views.courses page
    """
    if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
        return redirect(marketing_link('COURSES'), permanent=True)

    university = branding.get_university(request.META.get('HTTP_HOST'))
    if university == 'edge':
        return render_to_response('university_profile/edge.html', {})

    #  we do not expect this case to be reached in cases where
    #  marketing and edge are enabled
    return courseware.views.courses(request)
def newgroup_courses(request):
    """
    Render the "find courses" page. If the marketing site is enabled, redirect
    to that. Otherwise, if subdomain branding is on, this is the university
    profile page. Otherwise, it's the edX courseware.views.courses page
    """
    if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False):
        return redirect(marketing_link('COURSES'), permanent=True)

    university = branding.get_university(request.META.get('HTTP_HOST'))
    if university == 'edge':
        return render_to_response('university_profile/edge.html', {})

    #  we do not expect this case to be reached in cases where
    #  marketing and edge are enabled
    return courseware.views.newgroup_courses(request)