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
93c312cc
Kaydet (Commit)
93c312cc
authored
May 27, 2016
tarafından
inondle
Kaydeden (comit)
Tim Graham
May 27, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26573 -- Added descriptive error message for malformed if/else/elif template tags.
üst
ff6c6fea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
defaulttags.py
django/template/defaulttags.py
+2
-1
test_if.py
tests/template_tests/syntax_tests/test_if.py
+6
-0
No files found.
django/template/defaulttags.py
Dosyayı görüntüle @
93c312cc
...
...
@@ -969,7 +969,8 @@ def do_if(parser, token):
token
=
parser
.
next_token
()
# {% endif %}
assert
token
.
contents
==
'endif'
if
token
.
contents
!=
'endif'
:
raise
TemplateSyntaxError
(
'Malformed template tag at line {0}: "{1}"'
.
format
(
token
.
lineno
,
token
.
contents
))
return
IfNode
(
conditions_nodelists
)
...
...
tests/template_tests/syntax_tests/test_if.py
Dosyayı görüntüle @
93c312cc
...
...
@@ -508,6 +508,12 @@ class IfTagTests(SimpleTestCase):
with
self
.
assertRaises
(
TemplateSyntaxError
):
self
.
engine
.
get_template
(
'if-tag-error12'
)
@setup
({
'else-if-tag-error01'
:
'{
%
if foo is bar
%
} yes {
%
else if foo is not bar
%
} no {
%
endif
%
}'
})
def
test_else_if_tag_error01
(
self
):
error_message
=
'Malformed template tag at line 1: "else if foo is not bar"'
with
self
.
assertRaisesMessage
(
TemplateSyntaxError
,
error_message
):
self
.
engine
.
get_template
(
'else-if-tag-error01'
)
@setup
({
'if-tag-shortcircuit01'
:
'{
%
if x.is_true or x.is_bad
%
}yes{
%
else
%
}no{
%
endif
%
}'
})
def
test_if_tag_shortcircuit01
(
self
):
"""
...
...
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