From 467cf34c8a0136af3305e3e7803bcd46aadbe53e Mon Sep 17 00:00:00 2001 From: "Dave St.Germain" Date: Wed, 30 Jul 2014 11:05:48 -0400 Subject: [PATCH] A better check for the existence of matlabinput element. --- common/lib/capa/capa/responsetypes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 8fe5f4d4c8..fb7fa62f2b 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -1879,7 +1879,7 @@ class CodeResponse(LoncapaResponse): # matlab api key can be defined in course settings. if so, add it to the grader payload api_key = getattr(self.capa_system, 'matlab_api_key', None) - if self.xml.find('matlabinput') and api_key: + if api_key and self.xml.find('matlabinput') is not None: self.payload['token'] = api_key self.payload['endpoint_version'] = "2" self.payload['requestor_id'] = self.capa_system.anonymous_student_id