=== added file 'django/contrib/sessions/tests.py'
|
|
|
| 1 | r""" |
| 2 | >>> s = SessionWrapper(None) |
| 3 | |
| 4 | Inject data into the session cache. |
| 5 | >>> s._session_cache = {} |
| 6 | >>> s._session_cache['some key'] = 'exists' |
| 7 | |
| 8 | >>> s.pop('some key') |
| 9 | 'exists' |
| 10 | |
| 11 | >>> s.pop('some key', 'does not exist') |
| 12 | 'does not exist' |
| 13 | """ |
| 14 | |
| 15 | from django.contrib.sessions.middleware import SessionWrapper |
| 16 | |
| 17 | if __name__ == '__main__': |
| 18 | import doctest |
| 19 | doctest.testmod() |
=== modified file 'django/contrib/sessions/middleware.py'
|
|
|
36 | 36 | def get(self, key, default=None): |
37 | 37 | return self._session.get(key, default) |
38 | 38 | |
| 39 | def pop(self, key, *args): |
| 40 | return self._session.pop(key, *args) |
| 41 | |
39 | 42 | def set_test_cookie(self): |
40 | 43 | self[TEST_COOKIE_NAME] = TEST_COOKIE_VALUE |
41 | 44 | |