Changeset 8084
- Timestamp:
- 07/25/08 22:58:31 (4 months ago)
- Files:
-
- django/trunk/django/core/cache/backends/base.py (modified) (1 diff)
- django/trunk/tests/regressiontests/cache/tests.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/cache/backends/base.py
r6774 r8084 64 64 return self.get(key) is not None 65 65 66 __contains__ = has_key 66 def __contains__(self, key): 67 """ 68 Returns True if the key is in the cache and has not expired. 69 """ 70 # This is a separate method, rather than just a copy of has_key(), 71 # so that it always has the same functionality as has_key(), even 72 # if a subclass overrides it. 73 return self.has_key(key) django/trunk/tests/regressiontests/cache/tests.py
r6887 r8084 57 57 self.assertEqual(cache.has_key("hello1"), True) 58 58 self.assertEqual(cache.has_key("goodbye1"), False) 59 cache.set("empty", 'fred') 60 self.assertEqual(cache.has_key("empty"), True) 59 61 60 62 def test_in(self): … … 62 64 self.assertEqual("hello2" in cache, True) 63 65 self.assertEqual("goodbye2" in cache, False) 66 cache.set("empty", 'fred') 67 self.assertEqual("empty" in cache, True) 64 68 65 69 def test_data_types(self):
