Skip to content

Commit

Permalink
♻️(lti_toolbox) route captured URL value to _do_on_success
Browse files Browse the repository at this point in the history
While working with the URL dispatcher, it was necessary to capture a value
from the URL using angle brackets. This  captured value was channeled
as an argument into the `post` method.

This method serves as a bridge to the corresponding abstract method,
and I required a seamless way to transmit this captured value from the
`post method` to the final step, denoted as `_do_on_success`.
  • Loading branch information
lebaudantoine committed Aug 30, 2023
1 parent bef56b3 commit 2a43930
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sandbox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class SimpleLaunchURLVerification(BaseLTIView):
"""Example view to handle LTI launch request verification."""

def _do_on_success(self, lti_request: LTI) -> HttpResponse:
def _do_on_success(self, lti_request: LTI, *args, **kwargs) -> HttpResponse:
# Render a template with some debugging information
context = {
"message": "LTI request verified successfully",
Expand Down
4 changes: 2 additions & 2 deletions src/lti_toolbox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def post(self, request, *args, **kwargs) -> HttpResponse: # pylint: disable=W06
lti_request = LTI(request)
try:
lti_request.verify()
return self._do_on_success(lti_request)
return self._do_on_success(lti_request, *args, **kwargs)
except LTIException as error:
return self._do_on_failure(request, error)

@abstractmethod
def _do_on_success(self, lti_request: LTI) -> HttpResponse:
def _do_on_success(self, lti_request: LTI, *args, **kwargs) -> HttpResponse:
"""Process the request when the LTI requests is verified."""
raise NotImplementedError()

Expand Down

0 comments on commit 2a43930

Please sign in to comment.