Make type check for self.code a little more robust, give default val for mmlans so it's never undefined

This commit is contained in:
David Ormsbee
2013-02-10 19:03:25 -05:00
parent f94df6e3f5
commit fb1e7f3dc1
2 changed files with 2 additions and 3 deletions

View File

@@ -999,7 +999,7 @@ def sympy_check2():
self.context['debug'] = self.system.DEBUG
# exec the check function
if type(self.code) == str:
if isinstance(self.code, basestring):
try:
exec self.code in self.context['global_context'], self.context
correct = self.context['correct']

View File

@@ -238,8 +238,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
###### PMathML input ######
# convert mathml answer to formula
try:
if dynamath:
mmlans = dynamath[0]
mmlans = dynamath[0] if dynamath else None
except Exception, err:
mmlans = None
if not mmlans: