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
0de09846
Commit
0de09846
authored
Sep 17, 2013
by
Pavel Yushchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes shlex unicode
parent
ee02a2dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
common/lib/capa/capa/inputtypes.py
+2
-2
common/lib/capa/capa/tests/test_inputtypes.py
+4
-0
No files found.
common/lib/capa/capa/inputtypes.py
View file @
0de09846
...
...
@@ -309,13 +309,13 @@ class OptionInput(InputTypeBase):
id==description for now. TODO: make it possible to specify different id and descriptions.
"""
# parse the set of possible options
lexer
=
shlex
.
shlex
(
options
[
1
:
-
1
])
lexer
=
shlex
.
shlex
(
options
[
1
:
-
1
]
.
encode
(
'utf8'
)
)
lexer
.
quotes
=
"'"
# Allow options to be separated by whitespace as well as commas
lexer
.
whitespace
=
", "
# remove quotes
tokens
=
[
x
[
1
:
-
1
]
for
x
in
list
(
lexer
)]
tokens
=
[
x
[
1
:
-
1
]
.
decode
(
'utf8'
)
for
x
in
list
(
lexer
)]
# make list of (option_id, option_description), with description=id
return
[(
t
,
t
)
for
t
in
tokens
]
...
...
common/lib/capa/capa/tests/test_inputtypes.py
View file @
0de09846
...
...
@@ -75,6 +75,10 @@ class OptionInputTest(unittest.TestCase):
check
(
"('a', 'b')"
,
[
'a'
,
'b'
])
check
(
"('a b','b')"
,
[
'a b'
,
'b'
])
check
(
"('My
\"
quoted
\"
place','b')"
,
[
'My
\"
quoted
\"
place'
,
'b'
])
check
(
u"('б','в')"
,
[
u'б'
,
u'в'
])
check
(
u"('б', 'в')"
,
[
u'б'
,
u'в'
])
check
(
u"('б в','в')"
,
[
u'б в'
,
u'в'
])
check
(
u"('Мой
\"
кавыки
\"
место','в')"
,
[
u'Мой
\"
кавыки
\"
место'
,
u'в'
])
class
ChoiceGroupTest
(
unittest
.
TestCase
):
...
...
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