|
@@ -219,17 +219,17 @@ You can edit it multiple times.
|
|
|
|
|
|
Example: ``fav_color = request.session.pop('fav_color')``
|
|
|
|
|
|
- .. method:: keys
|
|
|
+ .. method:: keys()
|
|
|
|
|
|
- .. method:: items
|
|
|
+ .. method:: items()
|
|
|
|
|
|
- .. method:: setdefault
|
|
|
+ .. method:: setdefault()
|
|
|
|
|
|
- .. method:: clear
|
|
|
+ .. method:: clear()
|
|
|
|
|
|
It also has these methods:
|
|
|
|
|
|
- .. method:: flush
|
|
|
+ .. method:: flush()
|
|
|
|
|
|
Delete the current session data from the session and regenerate the
|
|
|
session key value that is sent back to the user in the cookie. This is
|
|
@@ -237,21 +237,21 @@ You can edit it multiple times.
|
|
|
accessed again from the user's browser (for example, the
|
|
|
:func:`django.contrib.auth.logout()` function calls it).
|
|
|
|
|
|
- .. method:: set_test_cookie
|
|
|
+ .. method:: set_test_cookie()
|
|
|
|
|
|
Sets a test cookie to determine whether the user's browser supports
|
|
|
cookies. Due to the way cookies work, you won't be able to test this
|
|
|
until the user's next page request. See `Setting test cookies`_ below for
|
|
|
more information.
|
|
|
|
|
|
- .. method:: test_cookie_worked
|
|
|
+ .. method:: test_cookie_worked()
|
|
|
|
|
|
Returns either ``True`` or ``False``, depending on whether the user's
|
|
|
browser accepted the test cookie. Due to the way cookies work, you'll
|
|
|
have to call ``set_test_cookie()`` on a previous, separate page request.
|
|
|
See `Setting test cookies`_ below for more information.
|
|
|
|
|
|
- .. method:: delete_test_cookie
|
|
|
+ .. method:: delete_test_cookie()
|
|
|
|
|
|
Deletes the test cookie. Use this to clean up after yourself.
|
|
|
|
|
@@ -280,7 +280,7 @@ You can edit it multiple times.
|
|
|
purposes. Session expiration is computed from the last time the
|
|
|
session was *modified*.
|
|
|
|
|
|
- .. method:: get_expiry_age
|
|
|
+ .. method:: get_expiry_age()
|
|
|
|
|
|
Returns the number of seconds until this session expires. For sessions
|
|
|
with no custom expiration (or those set to expire at browser close), this
|
|
@@ -295,7 +295,7 @@ You can edit it multiple times.
|
|
|
``None``. Defaults to the value stored in the session by
|
|
|
:meth:`set_expiry`, if there is one, or ``None``.
|
|
|
|
|
|
- .. method:: get_expiry_date
|
|
|
+ .. method:: get_expiry_date()
|
|
|
|
|
|
Returns the date this session will expire. For sessions with no custom
|
|
|
expiration (or those set to expire at browser close), this will equal the
|
|
@@ -303,17 +303,17 @@ You can edit it multiple times.
|
|
|
|
|
|
This function accepts the same keyword arguments as :meth:`get_expiry_age`.
|
|
|
|
|
|
- .. method:: get_expire_at_browser_close
|
|
|
+ .. method:: get_expire_at_browser_close()
|
|
|
|
|
|
Returns either ``True`` or ``False``, depending on whether the user's
|
|
|
session cookie will expire when the user's Web browser is closed.
|
|
|
|
|
|
- .. method:: clear_expired
|
|
|
+ .. method:: clear_expired()
|
|
|
|
|
|
Removes expired sessions from the session store. This class method is
|
|
|
called by :djadmin:`clearsessions`.
|
|
|
|
|
|
- .. method:: cycle_key
|
|
|
+ .. method:: cycle_key()
|
|
|
|
|
|
Creates a new session key while retaining the current session data.
|
|
|
:func:`django.contrib.auth.login()` calls this method to mitigate against
|