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
a2851f20
Kaydet (Commit)
a2851f20
authored
Kas 07, 2017
tarafından
Jonas Haag
Kaydeden (comit)
Tim Graham
Kas 07, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28720 -- Added HttpRequest.get_full_path_info().
üst
3e7497a0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
5 deletions
+24
-5
request.py
django/http/request.py
+8
-2
request-response.txt
docs/ref/request-response.txt
+9
-0
2.1.txt
docs/releases/2.1.txt
+1
-1
tests.py
tests/requests/tests.py
+6
-2
No files found.
django/http/request.py
Dosyayı görüntüle @
a2851f20
...
...
@@ -113,11 +113,17 @@ class HttpRequest:
return
str
(
port
)
def
get_full_path
(
self
,
force_append_slash
=
False
):
return
self
.
_get_full_path
(
self
.
path
,
force_append_slash
)
def
get_full_path_info
(
self
,
force_append_slash
=
False
):
return
self
.
_get_full_path
(
self
.
path_info
,
force_append_slash
)
def
_get_full_path
(
self
,
path
,
force_append_slash
):
# RFC 3986 requires query string arguments to be in the ASCII range.
# Rather than crash if this doesn't happen, we encode defensively.
return
'
%
s
%
s
%
s'
%
(
escape_uri_path
(
self
.
path
),
'/'
if
force_append_slash
and
not
self
.
path
.
endswith
(
'/'
)
else
''
,
escape_uri_path
(
path
),
'/'
if
force_append_slash
and
not
path
.
endswith
(
'/'
)
else
''
,
(
'?'
+
iri_to_uri
(
self
.
META
.
get
(
'QUERY_STRING'
,
''
)))
if
self
.
META
.
get
(
'QUERY_STRING'
,
''
)
else
''
)
...
...
docs/ref/request-response.txt
Dosyayı görüntüle @
a2851f20
...
...
@@ -284,6 +284,15 @@ Methods
Example: ``"/music/bands/the_beatles/?print=true"``
.. method:: HttpRequest.get_full_path_info()
.. versionadded:: 2.1
Like :meth:`get_full_path`, but uses :attr:`path_info` instead of
:attr:`path`.
Example: ``"/minfo/music/bands/the_beatles/?print=true"``
.. method:: HttpRequest.build_absolute_uri(location)
Returns the absolute URI form of ``location``. If no location is provided,
...
...
docs/releases/2.1.txt
Dosyayı görüntüle @
a2851f20
...
...
@@ -159,7 +159,7 @@ Models
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~
*
..
.
*
Added :meth:`.HttpRequest.get_full_path_info`
.
Serialization
~~~~~~~~~~~~~
...
...
tests/requests/tests.py
Dosyayı görüntüle @
a2851f20
...
...
@@ -38,16 +38,20 @@ class RequestsTests(SimpleTestCase):
def
test_httprequest_full_path
(
self
):
request
=
HttpRequest
()
request
.
path
=
request
.
path_info
=
'/;some/?awful/=path/foo:bar/'
request
.
path
=
'/;some/?awful/=path/foo:bar/'
request
.
path_info
=
'/prefix'
+
request
.
path
request
.
META
[
'QUERY_STRING'
]
=
';some=query&+query=string'
expected
=
'/
%3
Bsome/
%3
Fawful/
%3
Dpath/foo:bar/?;some=query&+query=string'
self
.
assertEqual
(
request
.
get_full_path
(),
expected
)
self
.
assertEqual
(
request
.
get_full_path_info
(),
'/prefix'
+
expected
)
def
test_httprequest_full_path_with_query_string_and_fragment
(
self
):
request
=
HttpRequest
()
request
.
path
=
request
.
path_info
=
'/foo#bar'
request
.
path
=
'/foo#bar'
request
.
path_info
=
'/prefix'
+
request
.
path
request
.
META
[
'QUERY_STRING'
]
=
'baz#quux'
self
.
assertEqual
(
request
.
get_full_path
(),
'/foo
%23
bar?baz#quux'
)
self
.
assertEqual
(
request
.
get_full_path_info
(),
'/prefix/foo
%23
bar?baz#quux'
)
def
test_httprequest_repr
(
self
):
request
=
HttpRequest
()
...
...
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