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
a8d12bc2
Kaydet (Commit)
a8d12bc2
authored
May 25, 2018
tarafından
Ryan Rubin
Kaydeden (comit)
Tim Graham
May 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #29400 -- Fixed crash in custom template filters that use decorated functions.
Regression in
620e9dd3
.
üst
96ea4f87
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
3 deletions
+18
-3
AUTHORS
AUTHORS
+1
-0
base.py
django/template/base.py
+2
-2
2.0.6.txt
docs/releases/2.0.6.txt
+2
-1
custom.py
tests/template_tests/templatetags/custom.py
+8
-0
test_custom.py
tests/template_tests/test_custom.py
+5
-0
No files found.
AUTHORS
Dosyayı görüntüle @
a8d12bc2
...
@@ -722,6 +722,7 @@ answer newbie questions, and generally made Django that much better:
...
@@ -722,6 +722,7 @@ answer newbie questions, and generally made Django that much better:
ryankanno
ryankanno
Ryan Kelly <ryan@rfk.id.au>
Ryan Kelly <ryan@rfk.id.au>
Ryan Niemeyer <https://profiles.google.com/ryan.niemeyer/about>
Ryan Niemeyer <https://profiles.google.com/ryan.niemeyer/about>
Ryan Rubin <ryanmrubin@gmail.com>
Ryno Mathee <rmathee@gmail.com>
Ryno Mathee <rmathee@gmail.com>
Sam Newman <http://www.magpiebrain.com/>
Sam Newman <http://www.magpiebrain.com/>
Sander Dijkhuis <sander.dijkhuis@gmail.com>
Sander Dijkhuis <sander.dijkhuis@gmail.com>
...
...
django/template/base.py
Dosyayı görüntüle @
a8d12bc2
...
@@ -53,7 +53,7 @@ times with multiple contexts)
...
@@ -53,7 +53,7 @@ times with multiple contexts)
import
logging
import
logging
import
re
import
re
from
enum
import
Enum
from
enum
import
Enum
from
inspect
import
getcallargs
,
getfullargspec
from
inspect
import
getcallargs
,
getfullargspec
,
unwrap
from
django.template.context
import
(
# NOQA: imported for backwards compatibility
from
django.template.context
import
(
# NOQA: imported for backwards compatibility
BaseContext
,
Context
,
ContextPopException
,
RequestContext
,
BaseContext
,
Context
,
ContextPopException
,
RequestContext
,
...
@@ -707,7 +707,7 @@ class FilterExpression:
...
@@ -707,7 +707,7 @@ class FilterExpression:
# First argument, filter input, is implied.
# First argument, filter input, is implied.
plen
=
len
(
provided
)
+
1
plen
=
len
(
provided
)
+
1
# Check to see if a decorator is providing the real function.
# Check to see if a decorator is providing the real function.
func
=
getattr
(
func
,
'_decorated_function'
,
func
)
func
=
unwrap
(
func
)
args
,
_
,
_
,
defaults
,
_
,
_
,
_
=
getfullargspec
(
func
)
args
,
_
,
_
,
defaults
,
_
,
_
,
_
=
getfullargspec
(
func
)
alen
=
len
(
args
)
alen
=
len
(
args
)
...
...
docs/releases/2.0.6.txt
Dosyayı görüntüle @
a8d12bc2
...
@@ -9,4 +9,5 @@ Django 2.0.6 fixes several bugs in 2.0.5.
...
@@ -9,4 +9,5 @@ Django 2.0.6 fixes several bugs in 2.0.5.
Bugfixes
Bugfixes
========
========
* ...
* Fixed a regression that broke custom template filters that use decorators
(:ticket:`29400`).
tests/template_tests/templatetags/custom.py
Dosyayı görüntüle @
a8d12bc2
...
@@ -3,6 +3,7 @@ import operator
...
@@ -3,6 +3,7 @@ import operator
from
django
import
template
from
django
import
template
from
django.template.defaultfilters
import
stringfilter
from
django.template.defaultfilters
import
stringfilter
from
django.utils.html
import
escape
,
format_html
from
django.utils.html
import
escape
,
format_html
from
django.utils.safestring
import
mark_safe
register
=
template
.
Library
()
register
=
template
.
Library
()
...
@@ -13,6 +14,13 @@ def trim(value, num):
...
@@ -13,6 +14,13 @@ def trim(value, num):
return
value
[:
num
]
return
value
[:
num
]
@register.filter
@mark_safe
def
make_data_div
(
value
):
"""A filter that uses a decorator (@mark_safe)."""
return
'<div data-name="
%
s"></div>'
%
value
@register.filter
@register.filter
def
noop
(
value
,
param
=
None
):
def
noop
(
value
,
param
=
None
):
"""A noop filter that always return its first argument and does nothing with
"""A noop filter that always return its first argument and does nothing with
...
...
tests/template_tests/test_custom.py
Dosyayı görüntüle @
a8d12bc2
...
@@ -25,6 +25,11 @@ class CustomFilterTests(SimpleTestCase):
...
@@ -25,6 +25,11 @@ class CustomFilterTests(SimpleTestCase):
"abcde"
"abcde"
)
)
def
test_decorated_filter
(
self
):
engine
=
Engine
(
libraries
=
LIBRARIES
)
t
=
engine
.
from_string
(
'{
%
load custom
%
}{{ name|make_data_div }}'
)
self
.
assertEqual
(
t
.
render
(
Context
({
'name'
:
'foo'
})),
'<div data-name="foo"></div>'
)
class
TagTestCase
(
SimpleTestCase
):
class
TagTestCase
(
SimpleTestCase
):
...
...
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