Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
900b7e25
Unverified
Commit
900b7e25
authored
5 years ago
by
Nimisha Asthagiri
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #20001 from mahyard/master
Support a URL address as FOOTER_ORGANIZATION_LOGO
parents
1cb09ec3
3d23ee43
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/branding/api.py
+5
-6
5 additions, 6 deletions
lms/djangoapps/branding/api.py
lms/djangoapps/branding/tests/test_views.py
+5
-8
5 additions, 8 deletions
lms/djangoapps/branding/tests/test_views.py
with
10 additions
and
14 deletions
lms/djangoapps/branding/api.py
+
5
−
6
View file @
900b7e25
...
...
@@ -486,13 +486,12 @@ def _absolute_url_staticfile(is_secure, name):
unicode
"""
url_path = staticfiles_storage.url(name)
# In production, the static file name will be an absolute
# URL pointing to a CDN. In this case, we can just return the URL.
if six.moves.urllib.parse.urlparse(name).netloc:
return name
# In production, the static files URL will be an absolute
# URL pointing to a CDN. If this happens, we can just
# return the URL.
if six.moves.urllib.parse.urlparse(url_path).netloc:
return url_path
url_path = staticfiles_storage.url(name)
# For local development, the returned URL will be relative,
# so we need to make it absolute.
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/branding/tests/test_views.py
+
5
−
8
View file @
900b7e25
...
...
@@ -9,7 +9,7 @@ import mock
import
six
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
from
django.test
import
TestCase
,
override_settings
from
django.urls
import
reverse
from
branding.models
import
BrandingApiConfig
...
...
@@ -109,13 +109,10 @@ class TestFooter(CacheIsolationTestCase):
def
test_absolute_urls_with_cdn
(
self
):
self
.
_set_feature_flag
(
True
)
# Ordinarily, we'd use `override_settings()` to override STATIC_URL,
# which is what the staticfiles storage backend is using to construct the URL.
# Unfortunately, other parts of the system are caching this value on module
# load, which can cause other tests to fail. To ensure that this change
# doesn't affect other tests, we patch the `url()` method directly instead.
cdn_url
=
"
http://cdn.example.com/static/image.png
"
with
mock
.
patch
(
'
branding.api.staticfiles_storage.url
'
,
return_value
=
cdn_url
):
# Requesting footer while we have overridden FOOTER_ORGANIZATION_IMAGE
# with an absolute url
cdn_url
=
u
"
http://cdn.example.com/static/image.png
"
with
override_settings
(
FOOTER_ORGANIZATION_IMAGE
=
cdn_url
):
resp
=
self
.
_get_footer
()
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment