Skip to content

Commit

Permalink
revert code
Browse files Browse the repository at this point in the history
  • Loading branch information
lijiahua-ay committed Feb 28, 2023
1 parent 5954e10 commit 14f981a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tastypie/compat.py
Expand Up @@ -47,14 +47,9 @@ def is_ajax(request):

# django 4.0
try:
from django.middleware.csrf import _does_token_match, _unmask_cipher_token, CSRF_TOKEN_LENGTH, InvalidTokenFormat # noqa

def compare_sanitized_tokens(request_csrf_token, csrf_token):
csrf_secret = csrf_token
if len(csrf_token) == CSRF_TOKEN_LENGTH:
csrf_secret = _unmask_cipher_token(csrf_token)
return _does_token_match(request_csrf_token, csrf_secret)
from django.middleware.csrf import _does_token_match, InvalidTokenFormat

compare_sanitized_tokens = _does_token_match
except ImportError:
pass

Expand Down

0 comments on commit 14f981a

Please sign in to comment.