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
2f67d0aa
Commit
2f67d0aa
authored
Feb 10, 2014
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove tabs.
parent
678749fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
common/lib/xmodule/xmodule/tests/test_utils_django.py
+13
-13
common/lib/xmodule/xmodule/util/django.py
+9
-9
No files found.
common/lib/xmodule/xmodule/tests/test_utils_django.py
View file @
2f67d0aa
...
...
@@ -4,17 +4,17 @@ from nose.tools import assert_is_none
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
())
common/lib/xmodule/xmodule/util/django.py
View file @
2f67d0aa
"""
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
"""
...
...
@@ -9,12 +9,12 @@ from crum import get_current_request
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
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