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
1a1c93e5
Commit
1a1c93e5
authored
Oct 31, 2017
by
John Eskew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove orphaned pre-startup code and tests.
parent
a36eb51a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1 additions
and
96 deletions
+1
-96
common/djangoapps/microsite_configuration/backends/base.py
+0
-11
common/djangoapps/microsite_configuration/microsite.py
+1
-10
common/djangoapps/microsite_configuration/tests/backends/test_base.py
+0
-33
common/djangoapps/microsite_configuration/tests/backends/test_database.py
+0
-17
common/djangoapps/microsite_configuration/tests/test_microsites.py
+0
-17
lms/startup.py
+0
-8
No files found.
common/djangoapps/microsite_configuration/backends/base.py
View file @
1a1c93e5
...
...
@@ -281,17 +281,6 @@ class BaseMicrositeBackend(AbstractBaseMicrositeBackend):
microsites_root
)
def
enable_microsites_pre_startup
(
self
,
log
):
"""
The TEMPLATE_ENGINE directory to search for microsite templates
in non-mako templates must be loaded before the django startup
"""
microsites_root
=
settings
.
MICROSITE_ROOT_DIR
if
self
.
has_configuration_set
():
settings
.
MAKO_TEMPLATES
[
'main'
]
.
insert
(
0
,
microsites_root
)
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
.
append
(
microsites_root
)
class
BaseMicrositeTemplateBackend
(
object
):
"""
...
...
common/djangoapps/microsite_configuration/microsite.py
View file @
1a1c93e5
...
...
@@ -17,7 +17,7 @@ __all__ = [
'is_request_in_microsite'
,
'get_value'
,
'has_override_value'
,
'get_template_path'
,
'get_value_for_org'
,
'get_all_orgs'
,
'clear'
,
'set_by_domain'
,
'enable_microsites'
,
'get_all_config'
,
'is_feature_enabled'
,
'enable_microsites_pre_startup'
,
'is_feature_enabled'
,
]
BACKEND
=
None
...
...
@@ -102,15 +102,6 @@ def set_by_domain(domain):
BACKEND
.
set_config_by_domain
(
domain
)
def
enable_microsites_pre_startup
(
log
):
"""
Prepare the feature settings that must be enabled before django.setup() or
autostartup() during the startup script
"""
if
is_feature_enabled
():
BACKEND
.
enable_microsites_pre_startup
(
log
)
def
enable_microsites
(
log
):
"""
Enable the use of microsites during the startup script
...
...
common/djangoapps/microsite_configuration/tests/backends/test_base.py
View file @
1a1c93e5
...
...
@@ -138,36 +138,3 @@ class AbstractBaseMicrositeBackendTests(TestCase):
with
self
.
assertRaises
(
NotImplementedError
):
backend
.
get_all_orgs
()
@patch
(
'microsite_configuration.microsite.BACKEND'
,
microsite
.
get_backend
(
'microsite_configuration.backends.base.BaseMicrositeBackend'
,
BaseMicrositeBackend
)
)
class
BaseMicrositeBackendTests
(
TestCase
):
"""
Go through and test the BaseMicrositeBackend class for behavior which is not
overriden in subclasses
"""
def
test_enable_microsites_pre_startup
(
self
):
"""
Tests microsite.test_enable_microsites_pre_startup works as expected.
"""
# remove microsite root directory paths first
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
=
[
path
for
path
in
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
if
path
!=
settings
.
MICROSITE_ROOT_DIR
]
with
patch
(
'microsite_configuration.backends.base.BaseMicrositeBackend.has_configuration_set'
,
return_value
=
False
):
microsite
.
enable_microsites_pre_startup
(
log
)
self
.
assertNotIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
])
with
patch
(
'microsite_configuration.backends.base.BaseMicrositeBackend.has_configuration_set'
,
return_value
=
True
):
microsite
.
enable_microsites_pre_startup
(
log
)
self
.
assertIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
])
common/djangoapps/microsite_configuration/tests/backends/test_database.py
View file @
1a1c93e5
...
...
@@ -102,23 +102,6 @@ class DatabaseMicrositeBackendTests(DatabaseMicrositeTestCase):
microsite
.
clear
()
self
.
assertIsNone
(
microsite
.
get_value
(
'platform_name'
))
def
test_enable_microsites_pre_startup
(
self
):
"""
Tests microsite.test_enable_microsites_pre_startup works as expected.
"""
# remove microsite root directory paths first
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
=
[
path
for
path
in
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
if
path
!=
settings
.
MICROSITE_ROOT_DIR
]
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'USE_MICROSITES'
:
False
}):
microsite
.
enable_microsites_pre_startup
(
log
)
self
.
assertNotIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
])
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'USE_MICROSITES'
:
True
}):
microsite
.
enable_microsites_pre_startup
(
log
)
self
.
assertIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
])
self
.
assertIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
MAKO_TEMPLATES
[
'main'
])
@patch
(
'edxmako.paths.add_lookup'
)
def
test_enable_microsites
(
self
,
add_lookup
):
"""
...
...
common/djangoapps/microsite_configuration/tests/test_microsites.py
View file @
1a1c93e5
...
...
@@ -81,20 +81,3 @@ class MicrositeTests(TestCase):
),
DatabaseMicrositeBackend
)
def
test_enable_microsites_pre_startup
(
self
):
"""
Tests microsite.test_enable_microsites_pre_startup is not used if the feature is turned off.
"""
# remove microsite root directory paths first
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
=
[
path
for
path
in
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
]
if
path
!=
settings
.
MICROSITE_ROOT_DIR
]
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'USE_MICROSITES'
:
False
}):
microsite
.
enable_microsites_pre_startup
(
log
)
self
.
assertNotIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
])
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'USE_MICROSITES'
:
True
}):
microsite
.
enable_microsites_pre_startup
(
log
)
self
.
assertIn
(
settings
.
MICROSITE_ROOT_DIR
,
settings
.
DEFAULT_TEMPLATE_ENGINE
[
'DIRS'
])
lms/startup.py
View file @
1a1c93e5
...
...
@@ -66,11 +66,3 @@ def add_mimetypes():
mimetypes
.
add_type
(
'application/x-font-opentype'
,
'.otf'
)
mimetypes
.
add_type
(
'application/x-font-ttf'
,
'.ttf'
)
mimetypes
.
add_type
(
'application/font-woff'
,
'.woff'
)
def
enable_microsites
():
"""
Calls the enable_microsites function in the microsite backend.
Here for backwards compatibility
"""
microsite
.
enable_microsites
(
log
)
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