Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added url as a parameter to allow user to set the url directly, becau… #65

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 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
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
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
Copy link
Contributor

Choose a reason for hiding this comment

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

pep8 issues

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