Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
300e8baf
Kaydet (Commit)
300e8baf
authored
May 26, 2015
tarafından
Paweł Marczewski
Kaydeden (comit)
Tim Graham
May 27, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24847 -- Prevented items set on a RequestContext from being lost.
üst
70be31bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
context.py
django/template/context.py
+7
-1
1.8.3.txt
docs/releases/1.8.3.txt
+3
-0
test_context.py
tests/template_tests/test_context.py
+10
-3
No files found.
django/template/context.py
Dosyayı görüntüle @
300e8baf
...
@@ -226,7 +226,13 @@ class RequestContext(Context):
...
@@ -226,7 +226,13 @@ class RequestContext(Context):
self
.
request
=
request
self
.
request
=
request
self
.
_processors
=
()
if
processors
is
None
else
tuple
(
processors
)
self
.
_processors
=
()
if
processors
is
None
else
tuple
(
processors
)
self
.
_processors_index
=
len
(
self
.
dicts
)
self
.
_processors_index
=
len
(
self
.
dicts
)
self
.
update
({})
# placeholder for context processors output
# placeholder for context processors output
self
.
update
({})
# empty dict for any new modifications
# (so that context processors don't overwrite them)
self
.
update
({})
@contextmanager
@contextmanager
def
bind_template
(
self
,
template
):
def
bind_template
(
self
,
template
):
...
...
docs/releases/1.8.3.txt
Dosyayı görüntüle @
300e8baf
...
@@ -22,3 +22,6 @@ Bugfixes
...
@@ -22,3 +22,6 @@ Bugfixes
* Reverted an optimization to the CSRF template context processor which caused
* Reverted an optimization to the CSRF template context processor which caused
a regression (:ticket:`24836`).
a regression (:ticket:`24836`).
* Fixed a regression which caused template context processors to overwrite
variables set on a ``RequestContext`` after it's created (:ticket:`24847`).
tests/template_tests/test_context.py
Dosyayı görüntüle @
300e8baf
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
django.http
import
HttpRequest
from
django.http
import
HttpRequest
from
django.template
import
(
from
django.template
import
(
Context
,
Engine
,
RequestContext
,
Variable
,
VariableDoesNotExist
,
Context
,
Engine
,
RequestContext
,
Template
,
Variable
,
VariableDoesNotExist
,
)
)
from
django.template.context
import
RenderContext
from
django.template.context
import
RenderContext
from
django.test
import
RequestFactory
,
SimpleTestCase
from
django.test
import
RequestFactory
,
SimpleTestCase
...
@@ -153,8 +153,8 @@ class RequestContextTests(SimpleTestCase):
...
@@ -153,8 +153,8 @@ class RequestContextTests(SimpleTestCase):
request
=
RequestFactory
()
.
get
(
'/'
)
request
=
RequestFactory
()
.
get
(
'/'
)
ctx
=
RequestContext
(
request
,
{})
ctx
=
RequestContext
(
request
,
{})
# The stack should now contain 3 items:
# The stack should now contain 3 items:
# [builtins, supplied context, context processor]
# [builtins, supplied context, context processor
, empty dict
]
self
.
assertEqual
(
len
(
ctx
.
dicts
),
3
)
self
.
assertEqual
(
len
(
ctx
.
dicts
),
4
)
def
test_context_comparable
(
self
):
def
test_context_comparable
(
self
):
# Create an engine without any context processors.
# Create an engine without any context processors.
...
@@ -168,3 +168,10 @@ class RequestContextTests(SimpleTestCase):
...
@@ -168,3 +168,10 @@ class RequestContextTests(SimpleTestCase):
RequestContext
(
request
,
dict_
=
test_data
),
RequestContext
(
request
,
dict_
=
test_data
),
RequestContext
(
request
,
dict_
=
test_data
),
RequestContext
(
request
,
dict_
=
test_data
),
)
)
def
test_modify_context_and_render
(
self
):
template
=
Template
(
'{{ foo }}'
)
request
=
RequestFactory
()
.
get
(
'/'
)
context
=
RequestContext
(
request
,
{})
context
[
'foo'
]
=
'foo'
self
.
assertEqual
(
template
.
render
(
context
),
'foo'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment