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
c715edf5
Commit
c715edf5
authored
Jun 06, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip off https://
parent
39397c5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
cms/djangoapps/contentstore/tests/test_utils.py
+18
-0
cms/djangoapps/contentstore/utils.py
+5
-2
No files found.
cms/djangoapps/contentstore/tests/test_utils.py
View file @
c715edf5
...
...
@@ -24,6 +24,24 @@ 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
=
{
'ROOT'
:
'http://www.dummy'
})
def
about_page_marketing_site_remove_http_test
(
self
):
""" Get URL for about page, marketing root present, remove http://. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//www.dummy/courses/mitX/101/test/about"
)
@override_settings
(
MKTG_URLS
=
{
'ROOT'
:
'https://www.dummy'
})
def
about_page_marketing_site_remove_https_test
(
self
):
""" Get URL for about page, marketing root present, remove https://. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//www.dummy/courses/mitX/101/test/about"
)
@override_settings
(
MKTG_URLS
=
{
'ROOT'
:
'www.dummyhttps://x'
})
def
about_page_marketing_site_https__edge_test
(
self
):
""" Get URL for about page, only remove https:// at the beginning of the string. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
self
.
assertEquals
(
self
.
get_about_page_link
(),
"//www.dummyhttps://x/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. """
...
...
cms/djangoapps/contentstore/utils.py
View file @
c715edf5
...
...
@@ -5,6 +5,7 @@ from xmodule.modulestore.exceptions import ItemNotFoundError
from
django.core.urlresolvers
import
reverse
import
copy
import
logging
import
re
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -120,9 +121,11 @@ def get_lms_link_for_about_page(location):
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
d
rupal course about page URL.
# Root will be "
https://
www.edx.org". The complete URL will still not be exactly correct,
# but redirects exist from www.edx.org to get to the
D
rupal course about page URL.
about_base
=
marketing_urls
.
get
(
'ROOT'
)
# Strip off https:// (or http://) to be consistent with the formatting of LMS_BASE.
about_base
=
re
.
sub
(
r"^https?://"
,
""
,
about_base
)
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