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
cbcb0ee8
Commit
cbcb0ee8
authored
Feb 27, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach edx-mako to force csrf_tokens to unicode (from smart_strings)
parent
78079213
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletions
+8
-1
common/djangoapps/edxmako/shortcuts.py
+7
-0
lms/djangoapps/courseware/module_render.py
+1
-1
No files found.
common/djangoapps/edxmako/shortcuts.py
View file @
cbcb0ee8
...
@@ -122,6 +122,13 @@ def render_to_string(template_name, dictionary, context=None, namespace='main'):
...
@@ -122,6 +122,13 @@ def render_to_string(template_name, dictionary, context=None, namespace='main'):
context_dictionary
.
update
(
item
)
context_dictionary
.
update
(
item
)
if
context
:
if
context
:
context_dictionary
.
update
(
context
)
context_dictionary
.
update
(
context
)
# "Fix" CSRF token by evaluating the lazy object
KEY_CSRF_TOKENS
=
(
'csrf_token'
,
'csrf'
)
for
key
in
KEY_CSRF_TOKENS
:
if
key
in
context_dictionary
:
context_dictionary
[
key
]
=
unicode
(
context_dictionary
[
key
])
# fetch and render template
# fetch and render template
template
=
lookup_template
(
namespace
,
template_name
)
template
=
lookup_template
(
namespace
,
template_name
)
return
template
.
render_unicode
(
**
context_dictionary
)
return
template
.
render_unicode
(
**
context_dictionary
)
...
...
lms/djangoapps/courseware/module_render.py
View file @
cbcb0ee8
...
@@ -975,7 +975,7 @@ def xblock_view(request, course_id, usage_id, view_name):
...
@@ -975,7 +975,7 @@ def xblock_view(request, course_id, usage_id, view_name):
return
JsonResponse
({
return
JsonResponse
({
'html'
:
fragment
.
content
,
'html'
:
fragment
.
content
,
'resources'
:
hashed_resources
.
items
(),
'resources'
:
hashed_resources
.
items
(),
'csrf_token'
:
str
(
csrf
(
request
)[
'csrf_token'
]),
'csrf_token'
:
unicode
(
csrf
(
request
)[
'csrf_token'
]),
})
})
...
...
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