Commits

Hynek Cernoch committed dd9f811

Marked unused code to be tested.

Comments (0)

Files changed (2)

keyedcache/__init__.py

         except AttributeError:
             return md5_hash(key)
 
+# this function is unused in all known apps and raises an
+# exception on CACHED_KEYS if used:
+# AttributeError: 'list' object has no attribute 'has_key'
 def cache_contains(*keys, **kwargs):
     key = cache_key(keys, **kwargs)
     return CACHED_KEYS.has_key(key)
     delimited by ':', automatically hashing any non-scalar objects."""
 
     if is_string_like(keys):
+        assert False, "This code is never visited due to python rules"
         keys = [keys]
 
     if is_list_or_tuple(keys):
         if len(keys) == 1 and is_list_or_tuple(keys[0]):
             keys = keys[0]
     else:
+        assert False, "This code is never visited due to python rules"
         keys = [md5_hash(keys)]
 
     if pairs:

keyedcache/models.py

         
     def is_cached(self, *args, **kwargs):
         return keyedcache.is_cached(self.cache_key(*args, **kwargs))
-        
+
+
+# Unused functions find_by_id, find_by_key, find_by_slug are coming from
+# Satchmo but are currently unused also there.
+
 def find_by_id(cls, groupkey, objectid, raises=False):
     """A helper function to look up an object by id"""
     ob = None