Skip to content

Commit 2f01b30

Browse files
committed
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.
1 parent 3266843 commit 2f01b30

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pylti/flask.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ def response_url(self):
208208
uses PYLTI_URL_FIX map to support edX dev-stack
209209
210210
:return: remapped lis_outcome_service_url
211+
:exception: LTIException if lis_outcome_service_url isn't present.
211212
"""
213+
if 'lis_outcome_service_url' not in session:
214+
raise LTIException('lis_outcome_service_url isn\'t present.')
212215
url = session['lis_outcome_service_url']
213216
app_config = self.lti_kwargs['app'].config
214217
urls = app_config.get('PYLTI_URL_FIX', dict())

0 commit comments

Comments
 (0)