Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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('/')
Exemple #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)
Exemple #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)
Exemple #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)
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)