id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 7967,"cache.has_key() doesn't do the same thing as ""key in cache""",Marty Alchin,Marty Alchin,"In [source:django/trunk/django/core/cache/backends/base.py django.core.cache.backends.base.BaseCache], `has_key()` is defined as a method, while `__contains__` is simply an alias for it. Individual backends override `has_key()` to be more efficient, but `__contains__` is left alone, so it's still an alias for the base function, which unfortunately means that the two end up with different implementations. This is generally fine, but shows itself when `None` is stored in the cache, which is a potentially useful situation. {{{ #!python >>> from django.core.cache import cache >>> cache.set('test', None) >>> cache.has_key('test') True >>> 'test' in cache False }}}",,closed,Core (Other),dev,,fixed,,,Unreviewed,1,0,0,0,0,0