Commits

g8mjg  committed 2a734b5

Changing fix to issue #64 per Mr. von Lowis' instructions

  • Participants
  • Parent commits 4bdd3c7

Comments (0)

Files changed (1)

File django/core/cache/backends/base.py

 "Base Cache class."
+import sys
 
 from django.core.exceptions import ImproperlyConfigured
 
         """
         Returns True if the key is in the cache and has not expired.
         """
+        # Overriding has_key in Python 3 is no longer supported.
+        # Please override __contains__ instead.
         return self.get(key) is not None
 
     def incr(self, key, delta=1):
         # This is a separate method, rather than just a copy of has_key(),
         # so that it always has the same functionality as has_key(), even
         # if a subclass overrides it.
+        
+        if sys.version_info<(3,):
+            return getattr(self, 'has_key')(key)
         return self.get(key) is not None
 
     def set_many(self, data, timeout=None):