Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions common/lib/xmodule/xmodule/tests/test_utils_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
from unittest import TestCase

class UtilDjangoTests(TestCase):
"""
Tests for methods exposed in util/django
"""
def test_get_current_request(self):
"""
Since we are running outside of Django assert that get_current_request returns None
"""
assert_is_none(get_current_request())
"""
Tests for methods exposed in util/django
"""
def test_get_current_request(self):
"""
Since we are running outside of Django assert that get_current_request returns None
"""
assert_is_none(get_current_request())

def test_get_current_request_hostname(self):
"""
Since we are running outside of Django assert that get_current_request_hostname returns None
"""
assert_is_none(get_current_request_hostname())
def test_get_current_request_hostname(self):
"""
Since we are running outside of Django assert that get_current_request_hostname returns None
"""
assert_is_none(get_current_request_hostname())
18 changes: 9 additions & 9 deletions common/lib/xmodule/xmodule/util/django.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Exposes Django utilities for consumption in the xmodule library
NOTE: This file should only be imported into 'django-safe' code, i.e. known that this code runs int the Django
NOTE: This file should only be imported into 'django-safe' code, i.e. known that this code runs int the Django
runtime environment with the djangoapps in common configured to load
"""

Expand All @@ -9,12 +9,12 @@


def get_current_request_hostname():
"""
This method will return the hostname that was used in the current Django request
"""
hostname = None
request = get_current_request()
if request:
hostname = request.META.get('HTTP_HOST')
"""
This method will return the hostname that was used in the current Django request
"""
hostname = None
request = get_current_request()
if request:
hostname = request.META.get('HTTP_HOST')

return hostname
return hostname