Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9220a4f4
Commit
9220a4f4
authored
Jun 06, 2013
by
cahrens
Committed by
John Jarvis
Jun 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bullet-proofing for MKTG_URLS.
parent
86a7a255
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
cms/djangoapps/contentstore/tests/test_utils.py
+6
-0
cms/djangoapps/contentstore/utils.py
+15
-3
No files found.
cms/djangoapps/contentstore/tests/test_utils.py
View file @
9220a4f4
...
...
@@ -24,6 +24,12 @@ class LMSLinksTestCase(TestCase):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
False
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//localhost:8000/courses/mitX/101/test/about"
)
@override_settings
(
MKTG_URLS
=
{})
def
about_page_marketing_urls_not_set_test
(
self
):
""" Error case. ENABLE_MKTG_SITE is True, but there is either no MKTG_URLS, or no MKTG_URLS Root property. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
None
)
@override_settings
(
LMS_BASE
=
None
)
def
about_page_no_lms_base_test
(
self
):
""" No LMS_BASE, nor is ENABLE_MKTG_SITE True """
...
...
cms/djangoapps/contentstore/utils.py
View file @
9220a4f4
...
...
@@ -4,6 +4,9 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
django.core.urlresolvers
import
reverse
import
copy
import
logging
log
=
logging
.
getLogger
(
__name__
)
DIRECT_ONLY_CATEGORIES
=
[
'course'
,
'chapter'
,
'sequential'
,
'about'
,
'static_tab'
,
'course_info'
]
...
...
@@ -108,9 +111,18 @@ def get_lms_link_for_about_page(location):
Returns the url to the course about page from the location tuple.
"""
if
settings
.
MITX_FEATURES
.
get
(
'ENABLE_MKTG_SITE'
,
False
):
# Root will be "www.edx.org". The complete URL will still not be exactly correct,
# but redirects exist from www.edx.org to get to the drupal course about page URL.
about_base
=
settings
.
MKTG_URLS
.
get
(
'ROOT'
)
if
not
hasattr
(
settings
,
'MKTG_URLS'
):
log
.
exception
(
"ENABLE_MKTG_SITE is True, but MKTG_URLS is not defined."
)
about_base
=
None
else
:
marketing_urls
=
settings
.
MKTG_URLS
if
marketing_urls
.
get
(
'ROOT'
,
None
)
is
None
:
log
.
exception
(
'There is no ROOT defined in MKTG_URLS'
)
about_base
=
None
else
:
# Root will be "www.edx.org". The complete URL will still not be exactly correct,
# but redirects exist from www.edx.org to get to the drupal course about page URL.
about_base
=
marketing_urls
.
get
(
'ROOT'
)
elif
settings
.
LMS_BASE
is
not
None
:
about_base
=
settings
.
LMS_BASE
else
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment