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
81edf2d0
Kaydet (Commit)
81edf2d0
authored
Haz 30, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed non-multiple of 4 indentation in docs/ref/request-response.txt.
üst
bbf0a954
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
74 deletions
+74
-74
request-response.txt
docs/ref/request-response.txt
+74
-74
No files found.
docs/ref/request-response.txt
Dosyayı görüntüle @
81edf2d0
...
@@ -34,10 +34,10 @@ All attributes should be considered read-only, unless stated otherwise below.
...
@@ -34,10 +34,10 @@ All attributes should be considered read-only, unless stated otherwise below.
.. attribute:: HttpRequest.scheme
.. attribute:: HttpRequest.scheme
.. versionadded:: 1.7
.. versionadded:: 1.7
A string representing the scheme of the request (``http`` or ``https``
A string representing the scheme of the request (``http`` or ``https``
usually).
usually).
.. attribute:: HttpRequest.body
.. attribute:: HttpRequest.body
...
@@ -251,68 +251,68 @@ Methods
...
@@ -251,68 +251,68 @@ Methods
.. method:: HttpRequest.get_full_path()
.. method:: HttpRequest.get_full_path()
Returns the ``path``, plus an appended query string, if applicable.
Returns the ``path``, plus an appended query string, if applicable.
Example: ``"/music/bands/the_beatles/?print=true"``
Example: ``"/music/bands/the_beatles/?print=true"``
.. method:: HttpRequest.build_absolute_uri(location)
.. method:: HttpRequest.build_absolute_uri(location)
Returns the absolute URI form of ``location``. If no location is provided,
Returns the absolute URI form of ``location``. If no location is provided,
the location will be set to ``request.get_full_path()``.
the location will be set to ``request.get_full_path()``.
If the location is already an absolute URI, it will not be altered.
If the location is already an absolute URI, it will not be altered.
Otherwise the absolute URI is built using the server variables available in
Otherwise the absolute URI is built using the server variables available in
this request.
this request.
Example: ``"http://example.com/music/bands/the_beatles/?print=true"``
Example: ``"http://example.com/music/bands/the_beatles/?print=true"``
.. method:: HttpRequest.get_signed_cookie(key, default=RAISE_ERROR, salt='', max_age=None)
.. method:: HttpRequest.get_signed_cookie(key, default=RAISE_ERROR, salt='', max_age=None)
Returns a cookie value for a signed cookie, or raises a
Returns a cookie value for a signed cookie, or raises a
``django.core.signing.BadSignature`` exception if the signature is
``django.core.signing.BadSignature`` exception if the signature is
no longer valid. If you provide the ``default`` argument the exception
no longer valid. If you provide the ``default`` argument the exception
will be suppressed and that default value will be returned instead.
will be suppressed and that default value will be returned instead.
The optional ``salt`` argument can be used to provide extra protection
The optional ``salt`` argument can be used to provide extra protection
against brute force attacks on your secret key. If supplied, the
against brute force attacks on your secret key. If supplied, the
``max_age`` argument will be checked against the signed timestamp
``max_age`` argument will be checked against the signed timestamp
attached to the cookie value to ensure the cookie is not older than
attached to the cookie value to ensure the cookie is not older than
``max_age`` seconds.
``max_age`` seconds.
For example::
For example::
>>> request.get_signed_cookie('name')
>>> request.get_signed_cookie('name')
'Tony'
'Tony'
>>> request.get_signed_cookie('name', salt='name-salt')
>>> request.get_signed_cookie('name', salt='name-salt')
'Tony' # assuming cookie was set using the same salt
'Tony' # assuming cookie was set using the same salt
>>> request.get_signed_cookie('non-existing-cookie')
>>> request.get_signed_cookie('non-existing-cookie')
...
...
KeyError: 'non-existing-cookie'
KeyError: 'non-existing-cookie'
>>> request.get_signed_cookie('non-existing-cookie', False)
>>> request.get_signed_cookie('non-existing-cookie', False)
False
False
>>> request.get_signed_cookie('cookie-that-was-tampered-with')
>>> request.get_signed_cookie('cookie-that-was-tampered-with')
...
...
BadSignature: ...
BadSignature: ...
>>> request.get_signed_cookie('name', max_age=60)
>>> request.get_signed_cookie('name', max_age=60)
...
...
SignatureExpired: Signature age 1677.3839159 > 60 seconds
SignatureExpired: Signature age 1677.3839159 > 60 seconds
>>> request.get_signed_cookie('name', False, max_age=60)
>>> request.get_signed_cookie('name', False, max_age=60)
False
False
See :doc:`cryptographic signing </topics/signing>` for more information.
See :doc:`cryptographic signing </topics/signing>` for more information.
.. method:: HttpRequest.is_secure()
.. method:: HttpRequest.is_secure()
Returns ``True`` if the request is secure; that is, if it was made with
Returns ``True`` if the request is secure; that is, if it was made with
HTTPS.
HTTPS.
.. method:: HttpRequest.is_ajax()
.. method:: HttpRequest.is_ajax()
Returns ``True`` if the request was made via an ``XMLHttpRequest``, by
Returns ``True`` if the request was made via an ``XMLHttpRequest``, by
checking the ``HTTP_X_REQUESTED_WITH`` header for the string
checking the ``HTTP_X_REQUESTED_WITH`` header for the string
``'XMLHttpRequest'``. Most modern JavaScript libraries send this header.
``'XMLHttpRequest'``. Most modern JavaScript libraries send this header.
If you write your own XMLHttpRequest call (on the browser side), you'll
If you write your own XMLHttpRequest call (on the browser side), you'll
have to set this header manually if you want ``is_ajax()`` to work.
have to set this header manually if you want ``is_ajax()`` to work.
.. method:: HttpRequest.read(size=None)
.. method:: HttpRequest.read(size=None)
.. method:: HttpRequest.readline()
.. method:: HttpRequest.readline()
...
@@ -357,23 +357,23 @@ a subclass of dictionary. Exceptions are outlined here:
...
@@ -357,23 +357,23 @@ a subclass of dictionary. Exceptions are outlined here:
.. method:: QueryDict.__init__(query_string=None, mutable=False, encoding=None)
.. method:: QueryDict.__init__(query_string=None, mutable=False, encoding=None)
Instantiates a ``QueryDict`` object based on ``query_string``.
Instantiates a ``QueryDict`` object based on ``query_string``.
>>> QueryDict('a=1&a=2&c=3')
>>> QueryDict('a=1&a=2&c=3')
<QueryDict: {u'a': [u'1', u'2'], u'b': [u'1']}>
<QueryDict: {u'a': [u'1', u'2'], u'b': [u'1']}>
If ``query_string`` is not passed in, the resulting ``QueryDict`` will be
If ``query_string`` is not passed in, the resulting ``QueryDict`` will be
empty (it will have no keys or values).
empty (it will have no keys or values).
Most ``QueryDict``\ s you encounter, and in particular those at
Most ``QueryDict``\ s you encounter, and in particular those at
``request.POST`` and ``request.GET``, will be immutable. If you are
``request.POST`` and ``request.GET``, will be immutable. If you are
instantiating one yourself, you can make it mutable by passing
instantiating one yourself, you can make it mutable by passing
``mutable=True`` to its ``__init__()``.
``mutable=True`` to its ``__init__()``.
Strings for setting both keys and values will be converted from ``encoding``
Strings for setting both keys and values will be converted from ``encoding``
to unicode. If encoding is not set, it defaults to :setting:`DEFAULT_CHARSET`.
to unicode. If encoding is not set, it defaults to :setting:`DEFAULT_CHARSET`.
.. versionchanged:: 1.8
.. versionchanged:: 1.8
In previous versions, ``query_string`` was a required positional argument.
In previous versions, ``query_string`` was a required positional argument.
...
@@ -413,21 +413,21 @@ a subclass of dictionary. Exceptions are outlined here:
...
@@ -413,21 +413,21 @@ a subclass of dictionary. Exceptions are outlined here:
dictionary ``update()`` method, except it *appends* to the current
dictionary ``update()`` method, except it *appends* to the current
dictionary items rather than replacing them. For example::
dictionary items rather than replacing them. For example::
>>> q = QueryDict('a=1', mutable=True)
>>> q = QueryDict('a=1', mutable=True)
>>> q.update({'a': '2'})
>>> q.update({'a': '2'})
>>> q.getlist('a')
>>> q.getlist('a')
['1', '2']
['1', '2']
>>> q['a'] # returns the last
>>> q['a'] # returns the last
['2']
['2']
.. method:: QueryDict.items()
.. method:: QueryDict.items()
Just like the standard dictionary ``items()`` method, except this uses the
Just like the standard dictionary ``items()`` method, except this uses the
same last-value logic as ``__getitem__()``. For example::
same last-value logic as ``__getitem__()``. For example::
>>> q = QueryDict('a=1&a=2&a=3')
>>> q = QueryDict('a=1&a=2&a=3')
>>> q.items()
>>> q.items()
[('a', '3')]
[('a', '3')]
.. method:: QueryDict.iteritems()
.. method:: QueryDict.iteritems()
...
@@ -445,9 +445,9 @@ a subclass of dictionary. Exceptions are outlined here:
...
@@ -445,9 +445,9 @@ a subclass of dictionary. Exceptions are outlined here:
Just like the standard dictionary ``values()`` method, except this uses the
Just like the standard dictionary ``values()`` method, except this uses the
same last-value logic as ``__getitem__()``. For example::
same last-value logic as ``__getitem__()``. For example::
>>> q = QueryDict('a=1&a=2&a=3')
>>> q = QueryDict('a=1&a=2&a=3')
>>> q.values()
>>> q.values()
['3']
['3']
.. method:: QueryDict.itervalues()
.. method:: QueryDict.itervalues()
...
...
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