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
b6e12224
Unverified
Commit
b6e12224
authored
Nov 15, 2017
by
Gabe Mulley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move helper function to theming helpers
parent
a031bf95
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
42 deletions
+37
-42
openedx/core/djangoapps/schedules/template_context.py
+1
-1
openedx/core/djangoapps/schedules/tracking.py
+1
-2
openedx/core/djangoapps/schedules/utils.py
+0
-39
openedx/core/djangoapps/theming/helpers.py
+35
-0
No files found.
openedx/core/djangoapps/schedules/template_context.py
View file @
b6e12224
...
@@ -2,7 +2,7 @@ from django.conf import settings
...
@@ -2,7 +2,7 @@ from django.conf import settings
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
edxmako.shortcuts
import
marketing_link
from
edxmako.shortcuts
import
marketing_link
from
openedx.core.djangoapps.
schedules.util
s
import
get_config_value_from_site_or_settings
from
openedx.core.djangoapps.
theming.helper
s
import
get_config_value_from_site_or_settings
def
get_base_template_context
(
site
):
def
get_base_template_context
(
site
):
...
...
openedx/core/djangoapps/schedules/tracking.py
View file @
b6e12224
...
@@ -3,8 +3,7 @@ from urlparse import parse_qs
...
@@ -3,8 +3,7 @@ from urlparse import parse_qs
import
attr
import
attr
from
django.utils.http
import
urlencode
from
django.utils.http
import
urlencode
from
openedx.core.djangoapps.schedules.utils
import
get_config_value_from_site_or_settings
from
openedx.core.djangoapps.theming.helpers
import
get_config_value_from_site_or_settings
DEFAULT_CAMPAIGN_SOURCE
=
'ace'
DEFAULT_CAMPAIGN_SOURCE
=
'ace'
DEFAULT_CAMPAIGN_MEDIUM
=
'email'
DEFAULT_CAMPAIGN_MEDIUM
=
'email'
...
...
openedx/core/djangoapps/schedules/utils.py
View file @
b6e12224
import
logging
import
logging
from
django.conf
import
settings
from
openedx.core.djangoapps.site_configuration.models
import
SiteConfiguration
from
openedx.core.djangoapps.theming.helpers
import
get_current_site
LOG
=
logging
.
getLogger
(
__name__
)
LOG
=
logging
.
getLogger
(
__name__
)
...
@@ -20,37 +15,3 @@ class PrefixedDebugLoggerMixin(object):
...
@@ -20,37 +15,3 @@ class PrefixedDebugLoggerMixin(object):
def
log_debug
(
self
,
message
,
*
args
,
**
kwargs
):
def
log_debug
(
self
,
message
,
*
args
,
**
kwargs
):
LOG
.
debug
(
self
.
log_prefix
+
': '
+
message
,
*
args
,
**
kwargs
)
LOG
.
debug
(
self
.
log_prefix
+
': '
+
message
,
*
args
,
**
kwargs
)
def
get_config_value_from_site_or_settings
(
name
,
site
=
None
,
site_config_name
=
None
):
"""
Given a configuration setting name, try to get it from the site configuration and then fall back on the settings.
If site_config_name is not specified then "name" is used as the key for both collections.
Args:
name (str): The name of the setting to get the value of.
site: The site that we are trying to fetch the value for.
site_config_name: The name of the setting within the site configuration.
Returns:
The value stored in the configuration.
"""
if
site_config_name
is
None
:
site_config_name
=
name
if
site
is
None
:
site
=
get_current_site
()
site_configuration
=
None
if
site
is
not
None
:
try
:
site_configuration
=
getattr
(
site
,
"configuration"
,
None
)
except
SiteConfiguration
.
DoesNotExist
:
pass
value_from_settings
=
getattr
(
settings
,
name
,
None
)
if
site_configuration
is
not
None
:
return
site_configuration
.
get_value
(
site_config_name
,
default
=
value_from_settings
)
else
:
return
value_from_settings
openedx/core/djangoapps/theming/helpers.py
View file @
b6e12224
...
@@ -10,6 +10,7 @@ from path import Path
...
@@ -10,6 +10,7 @@ from path import Path
from
microsite_configuration
import
microsite
from
microsite_configuration
import
microsite
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
from
openedx.core.djangoapps.site_configuration.models
import
SiteConfiguration
from
openedx.core.djangoapps.theming.helpers_dirs
import
(
from
openedx.core.djangoapps.theming.helpers_dirs
import
(
get_theme_base_dirs_from_settings
,
get_theme_base_dirs_from_settings
,
get_themes_unchecked
,
get_themes_unchecked
,
...
@@ -336,3 +337,37 @@ def is_comprehensive_theming_enabled():
...
@@ -336,3 +337,37 @@ def is_comprehensive_theming_enabled():
return
False
return
False
return
settings
.
ENABLE_COMPREHENSIVE_THEMING
return
settings
.
ENABLE_COMPREHENSIVE_THEMING
def
get_config_value_from_site_or_settings
(
name
,
site
=
None
,
site_config_name
=
None
):
"""
Given a configuration setting name, try to get it from the site configuration and then fall back on the settings.
If site_config_name is not specified then "name" is used as the key for both collections.
Args:
name (str): The name of the setting to get the value of.
site: The site that we are trying to fetch the value for.
site_config_name: The name of the setting within the site configuration.
Returns:
The value stored in the configuration.
"""
if
site_config_name
is
None
:
site_config_name
=
name
if
site
is
None
:
site
=
get_current_site
()
site_configuration
=
None
if
site
is
not
None
:
try
:
site_configuration
=
getattr
(
site
,
"configuration"
,
None
)
except
SiteConfiguration
.
DoesNotExist
:
pass
value_from_settings
=
getattr
(
settings
,
name
,
None
)
if
site_configuration
is
not
None
:
return
site_configuration
.
get_value
(
site_config_name
,
default
=
value_from_settings
)
else
:
return
value_from_settings
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