Loading django/contrib/sessions/backends/base.py +4 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,10 @@ class SessionBase(object): def iteritems(self): return self._session.iteritems() def clear(self): self._session.clear() self.modified = True def _get_new_session_key(self): "Returns session key that isn't being used." # The random module is seeded when this Apache child is created. Loading django/contrib/sessions/tests.py +9 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,15 @@ True >>> list(i) [('x', 1)] # test .clear() >>> s.modified = s.accessed = False >>> s.items() [('x', 1)] >>> s.clear() >>> s.items() [] >>> s.accessed, s.modified (True, True) ######################### # Custom session expiry # Loading docs/sessions.txt +3 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ When ``SessionMiddleware`` is activated, each ``HttpRequest`` object -- the first argument to any Django view function -- will have a ``session`` attribute, which is a dictionary-like object. You can read it and write to it. It implements the following standard dictionary methods: A session object has the following standard dictionary methods: * ``__getitem__(key)`` Loading Loading @@ -106,6 +106,8 @@ It implements the following standard dictionary methods: * ``setdefault()`` (**New in Django development version**) * ``clear()`` (**New in Django development version**) It also has these methods: * ``set_test_cookie()`` Loading Loading
django/contrib/sessions/backends/base.py +4 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,10 @@ class SessionBase(object): def iteritems(self): return self._session.iteritems() def clear(self): self._session.clear() self.modified = True def _get_new_session_key(self): "Returns session key that isn't being used." # The random module is seeded when this Apache child is created. Loading
django/contrib/sessions/tests.py +9 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,15 @@ True >>> list(i) [('x', 1)] # test .clear() >>> s.modified = s.accessed = False >>> s.items() [('x', 1)] >>> s.clear() >>> s.items() [] >>> s.accessed, s.modified (True, True) ######################### # Custom session expiry # Loading
docs/sessions.txt +3 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ When ``SessionMiddleware`` is activated, each ``HttpRequest`` object -- the first argument to any Django view function -- will have a ``session`` attribute, which is a dictionary-like object. You can read it and write to it. It implements the following standard dictionary methods: A session object has the following standard dictionary methods: * ``__getitem__(key)`` Loading Loading @@ -106,6 +106,8 @@ It implements the following standard dictionary methods: * ``setdefault()`` (**New in Django development version**) * ``clear()`` (**New in Django development version**) It also has these methods: * ``set_test_cookie()`` Loading