From fb1e7f3dc1f4a2d38035c18045ccf7c1ceb00917 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Sun, 10 Feb 2013 19:03:25 -0500 Subject: [PATCH] Make type check for self.code a little more robust, give default val for mmlans so it's never undefined --- common/lib/capa/capa/responsetypes.py | 2 +- lms/lib/symmath/symmath_check.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 78c986a963..ad084bdaf7 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -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'] diff --git a/lms/lib/symmath/symmath_check.py b/lms/lib/symmath/symmath_check.py index a3dec4aae5..d386ea6b06 100644 --- a/lms/lib/symmath/symmath_check.py +++ b/lms/lib/symmath/symmath_check.py @@ -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: