2007-05-21 12:03:53 +08:00
|
|
|
r"""
|
|
|
|
>>> s = SessionWrapper(None)
|
|
|
|
|
|
|
|
Inject data into the session cache.
|
|
|
|
>>> s._session_cache = {}
|
|
|
|
>>> s._session_cache['some key'] = 'exists'
|
|
|
|
|
2007-07-03 23:02:40 +08:00
|
|
|
>>> s.accessed
|
|
|
|
False
|
|
|
|
>>> s.modified
|
|
|
|
False
|
|
|
|
|
|
|
|
>>> s.pop('non existant key', 'does not exist')
|
|
|
|
'does not exist'
|
|
|
|
>>> s.accessed
|
|
|
|
True
|
|
|
|
>>> s.modified
|
|
|
|
False
|
|
|
|
|
2007-05-21 12:03:53 +08:00
|
|
|
>>> s.pop('some key')
|
|
|
|
'exists'
|
2007-07-03 23:02:40 +08:00
|
|
|
>>> s.accessed
|
|
|
|
True
|
|
|
|
>>> s.modified
|
|
|
|
True
|
2007-05-21 12:03:53 +08:00
|
|
|
|
|
|
|
>>> s.pop('some key', 'does not exist')
|
|
|
|
'does not exist'
|
|
|
|
"""
|
|
|
|
|
|
|
|
from django.contrib.sessions.middleware import SessionWrapper
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import doctest
|
|
|
|
doctest.testmod()
|