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
27b23217
Kaydet (Commit)
27b23217
authored
Agu 17, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #24451 -- Removed comma-separated {% cycle %} syntax per deprecation timeline.
üst
04ee4059
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
54 deletions
+1
-54
defaulttags.py
django/template/defaulttags.py
+0
-9
builtins.txt
docs/ref/templates/builtins.txt
+0
-12
test_cycle.py
tests/template_tests/syntax_tests/test_cycle.py
+1
-33
No files found.
django/template/defaulttags.py
Dosyayı görüntüle @
27b23217
...
...
@@ -619,15 +619,6 @@ def cycle(parser, token):
if
len
(
args
)
<
2
:
raise
TemplateSyntaxError
(
"'cycle' tag requires at least two arguments"
)
if
','
in
args
[
1
]:
warnings
.
warn
(
"The old {
%
cycle
%
} syntax with comma-separated arguments is deprecated."
,
RemovedInDjango110Warning
,
)
# Backwards compatibility: {% cycle a,b %} or {% cycle a,b as foo %}
# case.
args
[
1
:
2
]
=
[
'"
%
s"'
%
arg
for
arg
in
args
[
1
]
.
split
(
","
)]
if
len
(
args
)
==
2
:
# {% cycle foo %} case.
name
=
args
[
1
]
...
...
docs/ref/templates/builtins.txt
Dosyayı görüntüle @
27b23217
...
...
@@ -185,18 +185,6 @@ call to ``{% cycle %}`` doesn't specify ``silent``::
{% cycle 'row1' 'row2' as rowcolors silent %}
{% cycle rowcolors %}
.. deprecated:: 1.9
The ``{% cycle %}`` tag supports the much inferior old syntax from previous
Django versions. You shouldn't use this in any new projects, but for the
sake of the people who are still using it, here's what it looks like::
{% cycle row1,row2,row3 %}
In this syntax, each value gets interpreted as a literal string, and there's
no way to specify variable values, literal commas, or spaces. Support for
this syntax will be removed in Django 1.10.
.. templatetag:: debug
debug
...
...
tests/template_tests/syntax_tests/test_cycle.py
Dosyayı görüntüle @
27b23217
from
django.template
import
TemplateSyntaxError
from
django.test
import
SimpleTestCase
,
ignore_warnings
from
django.utils.deprecation
import
RemovedInDjango110Warning
from
django.test
import
SimpleTestCase
from
..utils
import
setup
...
...
@@ -12,24 +11,6 @@ class CycleTagTests(SimpleTestCase):
with
self
.
assertRaises
(
TemplateSyntaxError
):
self
.
engine
.
get_template
(
'cycle01'
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@setup
({
'cycle02'
:
'{
%
cycle a,b,c as abc
%
}{
%
cycle abc
%
}'
})
def
test_cycle02
(
self
):
output
=
self
.
engine
.
render_to_string
(
'cycle02'
)
self
.
assertEqual
(
output
,
'ab'
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@setup
({
'cycle03'
:
'{
%
cycle a,b,c as abc
%
}{
%
cycle abc
%
}{
%
cycle abc
%
}'
})
def
test_cycle03
(
self
):
output
=
self
.
engine
.
render_to_string
(
'cycle03'
)
self
.
assertEqual
(
output
,
'abc'
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@setup
({
'cycle04'
:
'{
%
cycle a,b,c as abc
%
}{
%
cycle abc
%
}{
%
cycle abc
%
}{
%
cycle abc
%
}'
})
def
test_cycle04
(
self
):
output
=
self
.
engine
.
render_to_string
(
'cycle04'
)
self
.
assertEqual
(
output
,
'abca'
)
@setup
({
'cycle05'
:
'{
%
cycle
%
}'
})
def
test_cycle05
(
self
):
with
self
.
assertRaises
(
TemplateSyntaxError
):
...
...
@@ -40,24 +21,11 @@ class CycleTagTests(SimpleTestCase):
with
self
.
assertRaises
(
TemplateSyntaxError
):
self
.
engine
.
get_template
(
'cycle06'
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@setup
({
'cycle07'
:
'{
%
cycle a,b,c as foo
%
}{
%
cycle bar
%
}'
})
def
test_cycle07
(
self
):
with
self
.
assertRaises
(
TemplateSyntaxError
):
self
.
engine
.
get_template
(
'cycle07'
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@setup
({
'cycle08'
:
'{
%
cycle a,b,c as foo
%
}{
%
cycle foo
%
}{{ foo }}{{ foo }}{
%
cycle foo
%
}{{ foo }}'
})
def
test_cycle08
(
self
):
output
=
self
.
engine
.
render_to_string
(
'cycle08'
)
self
.
assertEqual
(
output
,
'abbbcc'
)
@ignore_warnings
(
category
=
RemovedInDjango110Warning
)
@setup
({
'cycle09'
:
'{
%
for i in test
%
}{
%
cycle a,b
%
}{{ i }},{
%
endfor
%
}'
})
def
test_cycle09
(
self
):
output
=
self
.
engine
.
render_to_string
(
'cycle09'
,
{
'test'
:
list
(
range
(
5
))})
self
.
assertEqual
(
output
,
'a0,b1,a2,b3,a4,'
)
@setup
({
'cycle10'
:
"{
%
cycle 'a' 'b' 'c' as abc
%
}{
%
cycle abc
%
}"
})
def
test_cycle10
(
self
):
output
=
self
.
engine
.
render_to_string
(
'cycle10'
)
...
...
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