Skip to content

Commit

Permalink
Experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Sep 3, 2024
1 parent 8c626cd commit 65fcb84
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions identity/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,13 @@ def wrapper(request, *args, **kwargs):
if context:
try:
return function(request, *args, context=context, **kwargs)
except TypeError:
raise RuntimeError(
"Since identity 0.6.0, the '@login_required(...)' decorated "
"view should accept a keyword argument named 'context'. "
"For example, def my_view(request, *, context): ...") from None
except TypeError as exp:
if "context" in str(exp):
raise RuntimeError(
"Since identity 0.6.0, the '@login_required(...)' decorated "
"view should accept a keyword argument named 'context'. "
"For example, def my_view(request, *, context): ...") from exp
raise
# Save an http 302 by calling self.login(request) instead of redirect(self.login)
return self.login(
request,
Expand Down

0 comments on commit 65fcb84

Please sign in to comment.