Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pylti/flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def close_session():
session[LTI_SESSION_KEY] = False


def lti(app=None, request='any', error=default_error, role='any',
def lti(app=None, request='any', error=default_error, role='any', url=None,
*lti_args, **lti_kwargs):
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the doc string

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment as requested. Hopefully the comment will answer your question.

LTI decorator
Expand All @@ -339,6 +339,13 @@ def lti(app=None, request='any', error=default_error, role='any',
:param: request - Request type from
:py:attr:`pylti.common.LTI_REQUEST_TYPE`. (default: any)
:param: roles - LTI Role (default: any)
:param: url - This is an optional setting that allows you to set
the url directly. For example, if you have a web
server as a proxy in front of the Flask server with a url of
https://abc.com/app that is mapped to your Flask server url
that is at https://abc.com/ then you can use this parameter
like this: url='https://abc.com/app'

:return: wrapper
"""

Expand All @@ -356,6 +363,8 @@ def wrapper(*args, **kwargs):
Pass LTI reference to function or return error.
"""
try:
if url:
flask_request.url = url
the_lti = LTI(lti_args, lti_kwargs)
the_lti.verify()
the_lti._check_role() # pylint: disable=protected-access
Expand Down