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
6e4cea7b
Commit
6e4cea7b
authored
May 06, 2014
by
Anton Stupak
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3590 from edx/anton/i18n-string-response
StringResponse i18n.
parents
799c3611
d9aa28b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
common/lib/capa/capa/responsetypes.py
+8
-2
No files found.
common/lib/capa/capa/responsetypes.py
View file @
6e4cea7b
...
@@ -1375,6 +1375,7 @@ class StringResponse(LoncapaResponse):
...
@@ -1375,6 +1375,7 @@ class StringResponse(LoncapaResponse):
Note: for old code, which supports _or_ separator, we add some backward compatibility handling.
Note: for old code, which supports _or_ separator, we add some backward compatibility handling.
Should be removed soon. When to remove it, is up to Lyla Fisher.
Should be removed soon. When to remove it, is up to Lyla Fisher.
"""
"""
_
=
self
.
capa_system
.
i18n
.
ugettext
# backward compatibility, should be removed in future.
# backward compatibility, should be removed in future.
if
self
.
backward
:
if
self
.
backward
:
return
self
.
check_string_backward
(
expected
,
given
)
return
self
.
check_string_backward
(
expected
,
given
)
...
@@ -1386,7 +1387,10 @@ class StringResponse(LoncapaResponse):
...
@@ -1386,7 +1387,10 @@ class StringResponse(LoncapaResponse):
regexp
=
re
.
compile
(
'^'
+
'|'
.
join
(
expected
)
+
'$'
,
flags
=
flags
|
re
.
UNICODE
)
regexp
=
re
.
compile
(
'^'
+
'|'
.
join
(
expected
)
+
'$'
,
flags
=
flags
|
re
.
UNICODE
)
result
=
re
.
search
(
regexp
,
given
)
result
=
re
.
search
(
regexp
,
given
)
except
Exception
as
err
:
except
Exception
as
err
:
msg
=
'[courseware.capa.responsetypes.stringresponse] error: {}'
.
format
(
err
.
message
)
msg
=
u'[courseware.capa.responsetypes.stringresponse] {error}: {message}'
.
format
(
error
=
_
(
u'error'
),
message
=
err
.
message
)
log
.
error
(
msg
,
exc_info
=
True
)
log
.
error
(
msg
,
exc_info
=
True
)
raise
ResponseError
(
msg
)
raise
ResponseError
(
msg
)
return
bool
(
result
)
return
bool
(
result
)
...
@@ -1410,7 +1414,9 @@ class StringResponse(LoncapaResponse):
...
@@ -1410,7 +1414,9 @@ class StringResponse(LoncapaResponse):
return
hints_to_show
return
hints_to_show
def
get_answers
(
self
):
def
get_answers
(
self
):
return
{
self
.
answer_id
:
' <b>or</b> '
.
join
(
self
.
correct_answer
)}
_
=
self
.
capa_system
.
i18n
.
ugettext
separator
=
u' <b>{}</b> '
.
format
(
_
(
u'or'
))
return
{
self
.
answer_id
:
separator
.
join
(
self
.
correct_answer
)}
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
...
...
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