Commit 3aba2da9 by ichuang

capa_problem: convert print of errors into log.*

parent 941341bc
...@@ -109,6 +109,7 @@ class LoncapaProblem(object): ...@@ -109,6 +109,7 @@ class LoncapaProblem(object):
self.seed=struct.unpack('i', os.urandom(4))[0] self.seed=struct.unpack('i', os.urandom(4))[0]
## Parse XML file ## Parse XML file
log.info("[courseware.capa.capa_problem.lcp.init] fileobject = %s" % fileobject)
file_text = fileobject.read() file_text = fileobject.read()
self.fileobject = fileobject # save it, so we can use for debugging information later self.fileobject = fileobject # save it, so we can use for debugging information later
# Convert startouttext and endouttext to proper <text></text> # Convert startouttext and endouttext to proper <text></text>
...@@ -226,8 +227,8 @@ class LoncapaProblem(object): ...@@ -226,8 +227,8 @@ class LoncapaProblem(object):
try: try:
exec code in context, context # use "context" for global context; thus defs in code are global within code exec code in context, context # use "context" for global context; thus defs in code are global within code
except Exception,err: except Exception,err:
print "[courseware.capa.capa_problem.extract_context] error %s" % err log.exception("[courseware.capa.capa_problem.extract_context] error %s" % err)
print "in doing exec of this code:",code log.exception("in doing exec of this code: %s" % code)
return context return context
def get_html(self): def get_html(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment