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
f2309b31
Commit
f2309b31
authored
Jun 07, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove references to djangosettings from responsetypes.py
parent
f2423ca1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
common/lib/capa/checker.py
+1
-0
common/lib/capa/responsetypes.py
+7
-8
No files found.
common/lib/capa/checker.py
View file @
f2309b31
...
@@ -23,6 +23,7 @@ log = logging.getLogger('capa.checker')
...
@@ -23,6 +23,7 @@ log = logging.getLogger('capa.checker')
class
DemoSystem
(
object
):
class
DemoSystem
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
lookup
=
TemplateLookup
(
directories
=
[
path
(
__file__
)
.
dirname
()
/
'templates'
])
self
.
lookup
=
TemplateLookup
(
directories
=
[
path
(
__file__
)
.
dirname
()
/
'templates'
])
self
.
DEBUG
=
True
def
render_template
(
self
,
template_filename
,
dictionary
,
context
=
None
):
def
render_template
(
self
,
template_filename
,
dictionary
,
context
=
None
):
if
context
is
None
:
if
context
is
None
:
...
...
common/lib/capa/responsetypes.py
View file @
f2309b31
...
@@ -277,14 +277,14 @@ def sympy_check2():
...
@@ -277,14 +277,14 @@ def sympy_check2():
print
"can't find cfn in context = "
,
context
print
"can't find cfn in context = "
,
context
if
not
self
.
code
:
if
not
self
.
code
:
if
not
answer
:
if
answer
is
None
:
# raise Exception,"[courseware.capa.responsetypes.customresponse] missing code checking script! id=%s" % self.myid
# raise Exception,"[courseware.capa.responsetypes.customresponse] missing code checking script! id=%s" % self.myid
print
"[courseware.capa.responsetypes.customresponse] missing code checking script! id=
%
s"
%
self
.
myid
print
"[courseware.capa.responsetypes.customresponse] missing code checking script! id=
%
s"
%
self
.
myid
self
.
code
=
''
self
.
code
=
''
else
:
else
:
answer_src
=
answer
.
get
(
'src'
)
answer_src
=
answer
.
get
(
'src'
)
if
answer_src
is
not
None
:
if
answer_src
is
not
None
:
self
.
code
=
open
(
settings
.
DATA_DIR
+
'src/'
+
answer_src
)
.
read
()
self
.
code
=
self
.
system
.
filesystem
.
open
(
'src/'
+
answer_src
)
.
read
()
else
:
else
:
self
.
code
=
answer
.
text
self
.
code
=
answer
.
text
...
@@ -329,8 +329,7 @@ def sympy_check2():
...
@@ -329,8 +329,7 @@ def sympy_check2():
})
})
# pass self.system.debug to cfn
# pass self.system.debug to cfn
# if hasattr(self.system,'debug'): self.context['debug'] = self.system.debug
self
.
context
[
'debug'
]
=
self
.
system
.
DEBUG
self
.
context
[
'debug'
]
=
settings
.
DEBUG
# exec the check function
# exec the check function
if
type
(
self
.
code
)
==
str
:
if
type
(
self
.
code
)
==
str
:
...
@@ -492,7 +491,7 @@ main()
...
@@ -492,7 +491,7 @@ main()
answer_src
=
answer
.
get
(
'src'
)
answer_src
=
answer
.
get
(
'src'
)
if
answer_src
is
not
None
:
if
answer_src
is
not
None
:
self
.
code
=
open
(
settings
.
DATA_DIR
+
'src/'
+
answer_src
)
.
read
()
self
.
code
=
self
.
system
.
filesystem
.
open
(
'src/'
+
answer_src
)
.
read
()
else
:
else
:
self
.
code
=
answer
.
text
self
.
code
=
answer
.
text
...
@@ -522,7 +521,7 @@ main()
...
@@ -522,7 +521,7 @@ main()
log
.
error
(
msg
)
log
.
error
(
msg
)
raise
Exception
,
msg
raise
Exception
,
msg
if
se
ttings
.
DEBUG
:
log
.
info
(
'response =
%
s'
%
r
.
text
)
if
se
lf
.
system
.
DEBUG
:
log
.
info
(
'response =
%
s'
%
r
.
text
)
if
(
not
r
.
text
)
or
(
not
r
.
text
.
strip
()):
if
(
not
r
.
text
)
or
(
not
r
.
text
.
strip
()):
raise
Exception
,
'Error: no response from external server url=
%
s'
%
self
.
url
raise
Exception
,
'Error: no response from external server url=
%
s'
%
self
.
url
...
@@ -551,7 +550,7 @@ main()
...
@@ -551,7 +550,7 @@ main()
rxml
=
self
.
do_external_request
(
'get_score'
,
extra_payload
)
rxml
=
self
.
do_external_request
(
'get_score'
,
extra_payload
)
except
Exception
,
err
:
except
Exception
,
err
:
log
.
error
(
'Error
%
s'
%
err
)
log
.
error
(
'Error
%
s'
%
err
)
if
se
ttings
.
DEBUG
:
if
se
lf
.
system
.
DEBUG
:
correct_map
=
dict
(
zip
(
sorted
(
self
.
answer_ids
),
[
'incorrect'
]
*
len
(
self
.
answer_ids
)
))
correct_map
=
dict
(
zip
(
sorted
(
self
.
answer_ids
),
[
'incorrect'
]
*
len
(
self
.
answer_ids
)
))
correct_map
[
'msg_
%
s'
%
self
.
answer_ids
[
0
]]
=
'<font color="red" size="+2">
%
s</font>'
%
str
(
err
)
.
replace
(
'<'
,
'<'
)
correct_map
[
'msg_
%
s'
%
self
.
answer_ids
[
0
]]
=
'<font color="red" size="+2">
%
s</font>'
%
str
(
err
)
.
replace
(
'<'
,
'<'
)
return
correct_map
return
correct_map
...
@@ -581,7 +580,7 @@ main()
...
@@ -581,7 +580,7 @@ main()
exans
=
json
.
loads
(
rxml
.
find
(
'expected'
)
.
text
)
exans
=
json
.
loads
(
rxml
.
find
(
'expected'
)
.
text
)
except
Exception
,
err
:
except
Exception
,
err
:
log
.
error
(
'Error
%
s'
%
err
)
log
.
error
(
'Error
%
s'
%
err
)
if
se
ttings
.
DEBUG
:
if
se
lf
.
system
.
DEBUG
:
msg
=
'<font color=red size=+2>
%
s</font>'
%
str
(
err
)
.
replace
(
'<'
,
'<'
)
msg
=
'<font color=red size=+2>
%
s</font>'
%
str
(
err
)
.
replace
(
'<'
,
'<'
)
exans
=
[
''
]
*
len
(
self
.
answer_ids
)
exans
=
[
''
]
*
len
(
self
.
answer_ids
)
exans
[
0
]
=
msg
exans
[
0
]
=
msg
...
...
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