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
08bb238e
Kaydet (Commit)
08bb238e
authored
Ara 25, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #2105 from funkybob/cleanup_get_post
Used @cached_property for request.GET and COOKIES
üst
80027d2c
d7a4b156
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
19 deletions
+10
-19
wsgi.py
django/core/handlers/wsgi.py
+10
-19
No files found.
django/core/handlers/wsgi.py
Dosyayı görüntüle @
08bb238e
...
...
@@ -14,6 +14,7 @@ from django.core.handlers import base
from
django.core.urlresolvers
import
set_script_prefix
from
django.utils
import
datastructures
from
django.utils.encoding
import
force_str
,
force_text
from
django.utils.functional
import
cached_property
from
django.utils
import
six
# For backwards compatibility -- lots of code uses this in the wild!
...
...
@@ -136,15 +137,11 @@ class WSGIRequest(http.HttpRequest):
self
.
_request
=
datastructures
.
MergeDict
(
self
.
POST
,
self
.
GET
)
return
self
.
_request
def
_get_get
(
self
):
if
not
hasattr
(
self
,
'_get'
):
# The WSGI spec says 'QUERY_STRING' may be absent.
raw_query_string
=
get_bytes_from_wsgi
(
self
.
environ
,
'QUERY_STRING'
,
''
)
self
.
_get
=
http
.
QueryDict
(
raw_query_string
,
encoding
=
self
.
_encoding
)
return
self
.
_get
def
_set_get
(
self
,
get
):
self
.
_get
=
get
@cached_property
def
GET
(
self
):
# The WSGI spec says 'QUERY_STRING' may be absent.
raw_query_string
=
get_bytes_from_wsgi
(
self
.
environ
,
'QUERY_STRING'
,
''
)
return
http
.
QueryDict
(
raw_query_string
,
encoding
=
self
.
_encoding
)
def
_get_post
(
self
):
if
not
hasattr
(
self
,
'_post'
):
...
...
@@ -154,23 +151,17 @@ class WSGIRequest(http.HttpRequest):
def
_set_post
(
self
,
post
):
self
.
_post
=
post
def
_get_cookies
(
self
):
if
not
hasattr
(
self
,
'_cookies'
):
raw_cookie
=
get_str_from_wsgi
(
self
.
environ
,
'HTTP_COOKIE'
,
''
)
self
.
_cookies
=
http
.
parse_cookie
(
raw_cookie
)
return
self
.
_cookies
def
_set_cookies
(
self
,
cookies
):
self
.
_cookies
=
cookies
@cached_property
def
COOKIES
(
self
):
raw_cookie
=
get_str_from_wsgi
(
self
.
environ
,
'HTTP_COOKIE'
,
''
)
return
http
.
parse_cookie
(
raw_cookie
)
def
_get_files
(
self
):
if
not
hasattr
(
self
,
'_files'
):
self
.
_load_post_and_files
()
return
self
.
_files
GET
=
property
(
_get_get
,
_set_get
)
POST
=
property
(
_get_post
,
_set_post
)
COOKIES
=
property
(
_get_cookies
,
_set_cookies
)
FILES
=
property
(
_get_files
)
REQUEST
=
property
(
_get_request
)
...
...
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