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
40768ec2
Kaydet (Commit)
40768ec2
authored
Nis 24, 2015
tarafından
Harry
Kaydeden (comit)
Markus Holtermann
Nis 26, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24707 -- Improved error reporting for explicitly imported uncallable views
üst
86aaffa5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
urlresolvers.py
django/core/urlresolvers.py
+5
-0
erroneous_urls.py
tests/urlpatterns_reverse/erroneous_urls.py
+4
-2
tests.py
tests/urlpatterns_reverse/tests.py
+2
-1
views.py
tests/urlpatterns_reverse/views.py
+1
-1
No files found.
django/core/urlresolvers.py
Dosyayı görüntüle @
40768ec2
...
...
@@ -94,6 +94,11 @@ def get_callable(lookup_view, can_fail=False):
if
callable
(
lookup_view
):
return
lookup_view
if
not
isinstance
(
lookup_view
,
six
.
string_types
):
raise
ViewDoesNotExist
(
"'
%
s' is not a callable or a dot-notation path"
%
lookup_view
)
mod_name
,
func_name
=
get_mod_func
(
lookup_view
)
if
not
func_name
:
# No '.' in lookup_view
if
can_fail
:
...
...
tests/urlpatterns_reverse/erroneous_urls.py
Dosyayı görüntüle @
40768ec2
...
...
@@ -19,8 +19,10 @@ with warnings.catch_warnings():
url
(
r'erroneous_unqualified/$'
,
'unqualified_view'
),
# View does not exist
url
(
r'missing_inner/$'
,
'urlpatterns_reverse.views.missing_view'
),
# View is not callable
url
(
r'uncallable/$'
,
'urlpatterns_reverse.views.uncallable'
),
# View is not a callable (string import; arbitrary Python object)
url
(
r'uncallable-dotted/$'
,
'urlpatterns_reverse.views.uncallable'
),
# View is not a callable (explicit import; arbitrary Python object)
url
(
r'uncallable-object/$'
,
views
.
uncallable
),
# Module does not exist
url
(
r'missing_outer/$'
,
'urlpatterns_reverse.missing_module.missing_view'
),
# Regex contains an error (refs #6170)
...
...
tests/urlpatterns_reverse/tests.py
Dosyayı görüntüle @
40768ec2
...
...
@@ -762,7 +762,8 @@ class ErroneousViewTests(TestCase):
self
.
assertRaises
(
ImportError
,
self
.
client
.
get
,
'/erroneous_outer/'
)
self
.
assertRaises
(
ViewDoesNotExist
,
self
.
client
.
get
,
'/missing_inner/'
)
self
.
assertRaises
(
ViewDoesNotExist
,
self
.
client
.
get
,
'/missing_outer/'
)
self
.
assertRaises
(
ViewDoesNotExist
,
self
.
client
.
get
,
'/uncallable/'
)
self
.
assertRaises
(
ViewDoesNotExist
,
self
.
client
.
get
,
'/uncallable-dotted/'
)
self
.
assertRaises
(
ViewDoesNotExist
,
self
.
client
.
get
,
'/uncallable-object/'
)
# Regression test for #21157
self
.
assertRaises
(
ImportError
,
self
.
client
.
get
,
'/erroneous_unqualified/'
)
...
...
tests/urlpatterns_reverse/views.py
Dosyayı görüntüle @
40768ec2
...
...
@@ -35,7 +35,7 @@ def pass_resolver_match_view(request, *args, **kwargs):
response
.
resolver_match
=
request
.
resolver_match
return
response
uncallable
=
"Can I be a view? Pleeeease?"
uncallable
=
None
# neither a callable nor a string
class
ViewClass
(
object
):
...
...
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