From 2f01b30df1d50d9baf45d1c4f86158e89a82149d Mon Sep 17 00:00:00 2001 From: Nik Nyby Date: Fri, 28 Aug 2015 14:22:46 -0400 Subject: [PATCH] Fix KeyError in flask.py When submitting the grade form in the sample flask app (at /grade), pylti gave me this error: KeyError: 'lis_outcome_service_url' This commit turns the KeyError into a documented exception. I'm not too familiar with LTI yet so I'm not sure if this behavior is desired, but seems better to me. --- pylti/flask.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pylti/flask.py b/pylti/flask.py index 214c4ab..c48828a 100644 --- a/pylti/flask.py +++ b/pylti/flask.py @@ -208,7 +208,10 @@ def response_url(self): uses PYLTI_URL_FIX map to support edX dev-stack :return: remapped lis_outcome_service_url + :exception: LTIException if lis_outcome_service_url isn't present. """ + if 'lis_outcome_service_url' not in session: + raise LTIException('lis_outcome_service_url isn\'t present.') url = session['lis_outcome_service_url'] app_config = self.lti_kwargs['app'].config urls = app_config.get('PYLTI_URL_FIX', dict())