mirror of
https://github.com/django/django.git
synced 2025-10-30 00:56:09 +00:00
[1.8.x] Refs #24836 -- Reverted "Simplified the lazy CSRF token implementation in csrf context processor."
This reverts commit 8099d33b65 as it caused
a regression that cannot be solved without changing force_text() which has
a small risk of introducing regressions. This change will remain in master
along with an update to force_text().
This commit is contained in:
@@ -11,8 +11,9 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.middleware.csrf import get_token
|
||||
from django.utils import six
|
||||
from django.utils.encoding import smart_text
|
||||
from django.utils.functional import SimpleLazyObject, lazy
|
||||
from django.utils.functional import lazy
|
||||
|
||||
|
||||
def csrf(request):
|
||||
@@ -29,8 +30,9 @@ def csrf(request):
|
||||
return 'NOTPROVIDED'
|
||||
else:
|
||||
return smart_text(token)
|
||||
_get_val = lazy(_get_val, six.text_type)
|
||||
|
||||
return {'csrf_token': SimpleLazyObject(_get_val)}
|
||||
return {'csrf_token': _get_val()}
|
||||
|
||||
|
||||
def debug(request):
|
||||
|
||||
Reference in New Issue
Block a user