-
Notifications
You must be signed in to change notification settings - Fork 4.3k
add some middleware to determine whether draft modulestore or non-draft ... #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| """ | ||
| This configuration is have localdev use a preview.localhost hostname for the preview LMS so that we can share | ||
| the same process between preview and published | ||
| """ | ||
|
|
||
| # We intentionally define lots of variables that aren't used, and | ||
| # want to import all variables from base settings files | ||
| # pylint: disable=W0401, W0614 | ||
|
|
||
| from .dev import * | ||
|
|
||
| MITX_FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost:8000" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """Tests for methods defined in util/django.py""" | ||
| from xmodule.util.django import get_current_request, get_current_request_hostname | ||
| 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()) | ||
|
|
||
| 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()) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """ | ||
| 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 | ||
| runtime environment with the djangoapps in common configured to load | ||
| """ | ||
|
|
||
| # NOTE: we are importing this method so that any module that imports us has access to get_current_request | ||
| 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') | ||
|
|
||
| return hostname |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,7 @@ django_debug_toolbar | |
| django-debug-toolbar-mongo | ||
| nose-ignore-docstring | ||
| nose-exclude | ||
| django-crum==0.5 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jtauber can I get your signoff here? I forwarded in email a different 3rd party package. This package does the same thing, but I preferred it. It's also BSD, I believe.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, no problem with BSD. |
||
|
|
||
| git+https://github.com/mfogel/django-settings-context-processor.git | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps some documentation here explaining what this does?