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
45dfb364
Kaydet (Commit)
45dfb364
authored
Mar 11, 2019
tarafından
Jon Dufresne
Kaydeden (comit)
Tim Graham
Mar 11, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minimized try block in Client.request().
üst
ff09add2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
36 deletions
+27
-36
client.py
django/test/client.py
+27
-36
No files found.
django/test/client.py
Dosyayı görüntüle @
45dfb364
...
@@ -482,45 +482,36 @@ class Client(RequestFactory):
...
@@ -482,45 +482,36 @@ class Client(RequestFactory):
got_request_exception
.
connect
(
self
.
store_exc_info
,
dispatch_uid
=
exception_uid
)
got_request_exception
.
connect
(
self
.
store_exc_info
,
dispatch_uid
=
exception_uid
)
try
:
try
:
response
=
self
.
handler
(
environ
)
response
=
self
.
handler
(
environ
)
# Look for a signalled exception, clear the current context
# exception data, then re-raise the signalled exception.
# Also make sure that the signalled exception is cleared from
# the local cache!
response
.
exc_info
=
self
.
exc_info
if
self
.
exc_info
:
_
,
exc_value
,
_
=
self
.
exc_info
self
.
exc_info
=
None
if
self
.
raise_request_exception
:
raise
exc_value
# Save the client and request that stimulated the response.
response
.
client
=
self
response
.
request
=
request
# Add any rendered template detail to the response.
response
.
templates
=
data
.
get
(
"templates"
,
[])
response
.
context
=
data
.
get
(
"context"
)
response
.
json
=
partial
(
self
.
_parse_json
,
response
)
# Attach the ResolverMatch instance to the response
response
.
resolver_match
=
SimpleLazyObject
(
lambda
:
resolve
(
request
[
'PATH_INFO'
]))
# Flatten a single context. Not really necessary anymore thanks to
# the __getattr__ flattening in ContextList, but has some edge-case
# backwards-compatibility implications.
if
response
.
context
and
len
(
response
.
context
)
==
1
:
response
.
context
=
response
.
context
[
0
]
# Update persistent cookie data.
if
response
.
cookies
:
self
.
cookies
.
update
(
response
.
cookies
)
return
response
finally
:
finally
:
signals
.
template_rendered
.
disconnect
(
dispatch_uid
=
signal_uid
)
signals
.
template_rendered
.
disconnect
(
dispatch_uid
=
signal_uid
)
got_request_exception
.
disconnect
(
dispatch_uid
=
exception_uid
)
got_request_exception
.
disconnect
(
dispatch_uid
=
exception_uid
)
# Look for a signaled exception, clear the current context exception
# data, then re-raise the signaled exception. Also clear the signaled
# exception from the local cache.
response
.
exc_info
=
self
.
exc_info
if
self
.
exc_info
:
_
,
exc_value
,
_
=
self
.
exc_info
self
.
exc_info
=
None
if
self
.
raise_request_exception
:
raise
exc_value
# Save the client and request that stimulated the response.
response
.
client
=
self
response
.
request
=
request
# Add any rendered template detail to the response.
response
.
templates
=
data
.
get
(
'templates'
,
[])
response
.
context
=
data
.
get
(
'context'
)
response
.
json
=
partial
(
self
.
_parse_json
,
response
)
# Attach the ResolverMatch instance to the response.
response
.
resolver_match
=
SimpleLazyObject
(
lambda
:
resolve
(
request
[
'PATH_INFO'
]))
# Flatten a single context. Not really necessary anymore thanks to the
# __getattr__ flattening in ContextList, but has some edge case
# backwards compatibility implications.
if
response
.
context
and
len
(
response
.
context
)
==
1
:
response
.
context
=
response
.
context
[
0
]
# Update persistent cookie data.
if
response
.
cookies
:
self
.
cookies
.
update
(
response
.
cookies
)
return
response
def
get
(
self
,
path
,
data
=
None
,
follow
=
False
,
secure
=
False
,
**
extra
):
def
get
(
self
,
path
,
data
=
None
,
follow
=
False
,
secure
=
False
,
**
extra
):
"""Request a response from the server using GET."""
"""Request a response from the server using GET."""
...
...
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