This commit is contained in:
Kovid Goyal 2015-11-24 11:31:11 +05:30
parent aa2f592c98
commit ced4126d04

View File

@ -106,8 +106,11 @@ class GroupedSearchTerms(object):
def __init__(self, src):
self.keys = frozenset(src)
self.vals = frozenset(tuple(v) for v in src.itervalues())
self.hash = hash((self.keys, self.vals))
self.hash = hash(self.keys)
# We dont need to store values since this is used as part of a key for
# a cache and if the values have changed the cache will be invalidated
# for other reasons anyway (last_modified() will have changed on the
# db)
def __contains__(self, val):
return val in self.keys
@ -115,6 +118,12 @@ class GroupedSearchTerms(object):
def __hash__(self):
return self.hash
def __eq__(self, other):
try:
return self.keys == other.keys
except AttributeError:
return False
_icon_map = None
_icon_map_lock = Lock()