Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-utils
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
xblock-utils
Commits
7b721be7
Commit
7b721be7
authored
Jan 15, 2016
by
Tim Krones
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #36 from open-craft/use-utf-8
Support loading resources that contain non-ASCII characters
parents
e1c14356
51283d48
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
1 deletions
+17
-1
tests/unit/data/simple_django_template.txt
+4
-0
tests/unit/data/simple_mako_template.txt
+4
-0
tests/unit/test_resources.py
+8
-0
xblockutils/resources.py
+1
-1
No files found.
tests/unit/data/simple_django_template.txt
View file @
7b721be7
...
@@ -8,3 +8,7 @@ It can also do some fancy things with them:
...
@@ -8,3 +8,7 @@ It can also do some fancy things with them:
Default value if name is empty: {{name|default:"Default Name"}}
Default value if name is empty: {{name|default:"Default Name"}}
Length of the list: {{items|length}}
Length of the list: {{items|length}}
Items of the list:{% for item in items %} {{item}}{% endfor %}
Items of the list:{% for item in items %} {{item}}{% endfor %}
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
tests/unit/data/simple_mako_template.txt
View file @
7b721be7
...
@@ -12,3 +12,7 @@ Items of the list:\
...
@@ -12,3 +12,7 @@ Items of the list:\
${item}\
${item}\
% endfor
% endfor
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
tests/unit/test_resources.py
View file @
7b721be7
...
@@ -36,6 +36,10 @@ It can also do some fancy things with them:
...
@@ -36,6 +36,10 @@ It can also do some fancy things with them:
Default value if name is empty: {{name|default:"Default Name"}}
Default value if name is empty: {{name|default:"Default Name"}}
Length of the list: {{items|length}}
Length of the list: {{items|length}}
Items of the list:{
%
for item in items
%
} {{item}}{
%
endfor
%
}
Items of the list:{
%
for item in items
%
} {{item}}{
%
endfor
%
}
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
"""
"""
...
@@ -56,6 +60,10 @@ It can also do some fancy things with them:
...
@@ -56,6 +60,10 @@ It can also do some fancy things with them:
Default value if name is empty: This is a fine name
Default value if name is empty: This is a fine name
Length of the list: 7
Length of the list: 7
Items of the list: 1 2 3 4 a b c
Items of the list: 1 2 3 4 a b c
Although it is simple, it can also contain non-ASCII characters:
Thé Fütüré øf Ønlïné Édüçätïøn Ⱡσяєм ι# Før änýøné, änýwhéré, änýtïmé Ⱡσяєм #
"""
"""
example_id
=
"example-unique-id"
example_id
=
"example-unique-id"
...
...
xblockutils/resources.py
View file @
7b721be7
...
@@ -44,7 +44,7 @@ class ResourceLoader(object):
...
@@ -44,7 +44,7 @@ class ResourceLoader(object):
Gets the content of a resource
Gets the content of a resource
"""
"""
resource_content
=
pkg_resources
.
resource_string
(
self
.
module_name
,
resource_path
)
resource_content
=
pkg_resources
.
resource_string
(
self
.
module_name
,
resource_path
)
return
unicode
(
resource_content
)
return
unicode
(
resource_content
,
'utf-8'
)
def
render_django_template
(
self
,
template_path
,
context
=
None
):
def
render_django_template
(
self
,
template_path
,
context
=
None
):
"""
"""
...
...
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