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
Hide 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')
class
DemoSystem
(
object
):
def
__init__
(
self
):
self
.
lookup
=
TemplateLookup
(
directories
=
[
path
(
__file__
)
.
dirname
()
/
'templates'
])
self
.
DEBUG
=
True
def
render_template
(
self
,
template_filename
,
dictionary
,
context
=
None
):
if
context
is
None
:
...
...
common/lib/capa/responsetypes.py
View file @
f2309b31
...
...
@@ -277,14 +277,14 @@ def sympy_check2():
print
"can't find cfn in context = "
,
context
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
print
"[courseware.capa.responsetypes.customresponse] missing code checking script! id=
%
s"
%
self
.
myid
self
.
code
=
''
else
:
answer_src
=
answer
.
get
(
'src'
)
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
:
self
.
code
=
answer
.
text
...
...
@@ -329,8 +329,7 @@ def sympy_check2():
})
# pass self.system.debug to cfn
# if hasattr(self.system,'debug'): self.context['debug'] = self.system.debug
self
.
context
[
'debug'
]
=
settings
.
DEBUG
self
.
context
[
'debug'
]
=
self
.
system
.
DEBUG
# exec the check function
if
type
(
self
.
code
)
==
str
:
...
...
@@ -492,7 +491,7 @@ main()
answer_src
=
answer
.
get
(
'src'
)
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
:
self
.
code
=
answer
.
text
...
...
@@ -522,7 +521,7 @@ main()
log
.
error
(
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
()):
raise
Exception
,
'Error: no response from external server url=
%
s'
%
self
.
url
...
...
@@ -551,7 +550,7 @@ main()
rxml
=
self
.
do_external_request
(
'get_score'
,
extra_payload
)
except
Exception
,
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
[
'msg_
%
s'
%
self
.
answer_ids
[
0
]]
=
'<font color="red" size="+2">
%
s</font>'
%
str
(
err
)
.
replace
(
'<'
,
'<'
)
return
correct_map
...
...
@@ -581,7 +580,7 @@ main()
exans
=
json
.
loads
(
rxml
.
find
(
'expected'
)
.
text
)
except
Exception
,
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
(
'<'
,
'<'
)
exans
=
[
''
]
*
len
(
self
.
answer_ids
)
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