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
9f2881de
Kaydet (Commit)
9f2881de
authored
Eki 04, 2015
tarafından
Pindi Albert
Kaydeden (comit)
Tim Graham
Eki 05, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25423 -- Made error message for unknown template tag more helpful.
üst
28753258
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
base.py
django/template/base.py
+7
-2
tests.py
tests/template_tests/tests.py
+12
-5
No files found.
django/template/base.py
Dosyayı görüntüle @
9f2881de
...
@@ -553,13 +553,18 @@ class Parser(object):
...
@@ -553,13 +553,18 @@ class Parser(object):
if
parse_until
:
if
parse_until
:
raise
self
.
error
(
raise
self
.
error
(
token
,
token
,
"Invalid block tag on line
%
d: '
%
s', expected
%
s"
%
(
"Invalid block tag on line
%
d: '
%
s', expected
%
s. Did you "
"forget to register or load this tag?"
%
(
token
.
lineno
,
token
.
lineno
,
command
,
command
,
get_text_list
([
"'
%
s'"
%
p
for
p
in
parse_until
]),
get_text_list
([
"'
%
s'"
%
p
for
p
in
parse_until
]),
),
),
)
)
raise
self
.
error
(
token
,
"Invalid block tag on line
%
d: '
%
s'"
%
(
token
.
lineno
,
command
))
raise
self
.
error
(
token
,
"Invalid block tag on line
%
d: '
%
s'. Did you forget to register "
"or load this tag?"
%
(
token
.
lineno
,
command
)
)
def
unclosed_block_tag
(
self
,
parse_until
):
def
unclosed_block_tag
(
self
,
parse_until
):
command
,
token
=
self
.
command_stack
.
pop
()
command
,
token
=
self
.
command_stack
.
pop
()
...
...
tests/template_tests/tests.py
Dosyayı görüntüle @
9f2881de
...
@@ -68,14 +68,21 @@ class TemplateTests(SimpleTestCase):
...
@@ -68,14 +68,21 @@ class TemplateTests(SimpleTestCase):
#7876 -- Error messages should include the unexpected block name.
#7876 -- Error messages should include the unexpected block name.
"""
"""
engine
=
Engine
()
engine
=
Engine
()
msg
=
(
with
self
.
assertRaises
(
TemplateSyntaxError
)
as
e
:
"Invalid block tag on line 1: 'endblock', expected 'elif', 'else' "
"or 'endif'. Did you forget to register or load this tag?"
)
with
self
.
assertRaisesMessage
(
TemplateSyntaxError
,
msg
):
engine
.
from_string
(
"{
%
if 1
%
}lala{
%
endblock
%
}{
%
endif
%
}"
)
engine
.
from_string
(
"{
%
if 1
%
}lala{
%
endblock
%
}{
%
endif
%
}"
)
self
.
assertEqual
(
def
test_unknown_block_tag
(
self
):
e
.
exception
.
args
[
0
],
engine
=
Engine
()
"Invalid block tag on line 1: 'endblock', expected 'elif', 'else' or 'endif'"
,
msg
=
(
"Invalid block tag on line 1: 'foobar'. Did you forget to "
"register or load this tag?"
)
)
with
self
.
assertRaisesMessage
(
TemplateSyntaxError
,
msg
):
engine
.
from_string
(
"lala{
%
foobar
%
}"
)
def
test_compile_filter_expression_error
(
self
):
def
test_compile_filter_expression_error
(
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