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
537dd040
Commit
537dd040
authored
Apr 12, 2016
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12117 from edx/ned/fix-mako-encoding
Fix encoding of Django-called Mako files to be safe
parents
7864ec1c
4f9f87c1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
5 deletions
+3
-5
common/djangoapps/edxmako/makoloader.py
+2
-0
common/djangoapps/edxmako/template.py
+1
-5
No files found.
common/djangoapps/edxmako/makoloader.py
View file @
537dd040
...
...
@@ -48,6 +48,8 @@ class MakoLoader(object):
module_directory
=
self
.
module_directory
,
input_encoding
=
'utf-8'
,
output_encoding
=
'utf-8'
,
default_filters
=
[
'decode.utf8'
],
encoding_errors
=
'replace'
,
uri
=
template_name
)
return
template
,
None
else
:
...
...
common/djangoapps/edxmako/template.py
View file @
537dd040
...
...
@@ -19,8 +19,6 @@ from edxmako.middleware import get_template_request_context
from
edxmako.shortcuts
import
marketing_link
from
mako.template
import
Template
as
MakoTemplate
DJANGO_VARIABLES
=
[
'output_encoding'
,
'encoding_errors'
]
# TODO: We should make this a Django Template subclass that simply has the MakoTemplate inside of it? (Intead of inheriting from MakoTemplate)
...
...
@@ -34,9 +32,7 @@ class Template(MakoTemplate):
def
__init__
(
self
,
*
args
,
**
kwargs
):
"""Overrides base __init__ to provide django variable overrides"""
if
not
kwargs
.
get
(
'no_django'
,
False
):
overrides
=
{
k
:
getattr
(
edxmako
,
k
,
None
)
for
k
in
DJANGO_VARIABLES
}
overrides
[
'lookup'
]
=
edxmako
.
LOOKUP
[
'main'
]
kwargs
.
update
(
overrides
)
kwargs
[
'lookup'
]
=
edxmako
.
LOOKUP
[
'main'
]
super
(
Template
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
render
(
self
,
context_instance
):
...
...
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