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
13aa77b0
Commit
13aa77b0
authored
Oct 24, 2013
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1021 from smartdec/select/fix-shlex-unicode
FIX - Fixes dropdown problem with non latin options
parents
9042a0a8
72aa5cbf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
AUTHORS
+2
-2
common/lib/capa/capa/inputtypes.py
+2
-2
common/lib/capa/capa/tests/test_inputtypes.py
+4
-0
No files found.
AUTHORS
View file @
13aa77b0
...
...
@@ -90,4 +90,5 @@ Nick Parlante <nick.parlante@cs.stanford.edu>
Marko Seric <marko.seric@math.uzh.ch>
Felipe Montoya <felipe.montoya@edunext.co>
Julia Hansbrough <julia@edx.org>
Nicolas Chevalier <nicolas.chevalier@epitech.eu>
\ No newline at end of file
Pavel Yushchenko <pavelyushchenko@gmail.com>
Nicolas Chevalier <nicolas.chevalier@epitech.eu>
common/lib/capa/capa/inputtypes.py
View file @
13aa77b0
...
...
@@ -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
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 @
13aa77b0
...
...
@@ -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