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
3aecaba7
Commit
3aecaba7
authored
Apr 02, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3168 from cpennington/fix-lms-2489
Fix bad interaction between pluggable InputTypes and Microsites
parents
363702ea
c54972e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
common/djangoapps/edxmako/paths.py
+7
-4
lms/startup.py
+2
-4
No files found.
common/djangoapps/edxmako/paths.py
View file @
3aecaba7
...
...
@@ -15,11 +15,14 @@ class DynamicTemplateLookup(TemplateLookup):
A specialization of the standard mako `TemplateLookup` class which allows
for adding directories progressively.
"""
def
add_directory
(
self
,
directory
):
def
add_directory
(
self
,
directory
,
prepend
=
False
):
"""
Add a new directory to the template lookup path.
"""
self
.
directories
.
append
(
os
.
path
.
normpath
(
directory
))
if
prepend
:
self
.
directories
.
insert
(
0
,
os
.
path
.
normpath
(
directory
))
else
:
self
.
directories
.
append
(
os
.
path
.
normpath
(
directory
))
def
clear_lookups
(
namespace
):
...
...
@@ -29,7 +32,7 @@ def clear_lookups(namespace):
if
namespace
in
LOOKUP
:
del
LOOKUP
[
namespace
]
def
add_lookup
(
namespace
,
directory
,
package
=
None
):
def
add_lookup
(
namespace
,
directory
,
package
=
None
,
prepend
=
False
):
"""
Adds a new mako template lookup directory to the given namespace.
...
...
@@ -48,7 +51,7 @@ def add_lookup(namespace, directory, package=None):
)
if
package
:
directory
=
pkg_resources
.
resource_filename
(
package
,
directory
)
templates
.
add_directory
(
directory
)
templates
.
add_directory
(
directory
,
prepend
=
prepend
)
def
lookup_template
(
namespace
,
name
):
...
...
lms/startup.py
View file @
3aecaba7
...
...
@@ -52,8 +52,7 @@ def enable_theme():
# Include the theme's templates in the template search paths
settings
.
TEMPLATE_DIRS
.
insert
(
0
,
theme_root
/
'templates'
)
settings
.
MAKO_TEMPLATES
[
'main'
]
.
insert
(
0
,
theme_root
/
'templates'
)
edxmako
.
startup
.
run
()
edxmako
.
paths
.
add_lookup
(
'main'
,
theme_root
/
'templates'
,
prepend
=
True
)
# Namespace the theme's static files to 'themes/<theme_name>' to
# avoid collisions with default edX static files
...
...
@@ -98,8 +97,7 @@ def enable_microsites():
# if we have any valid microsites defined, let's wire in the Mako and STATIC_FILES search paths
if
microsite_config_dict
:
settings
.
TEMPLATE_DIRS
.
append
(
microsites_root
)
settings
.
MAKO_TEMPLATES
[
'main'
]
.
append
(
microsites_root
)
edxmako
.
startup
.
run
()
edxmako
.
paths
.
add_lookup
(
'main'
,
microsites_root
)
settings
.
STATICFILES_DIRS
.
insert
(
0
,
microsites_root
)
...
...
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