comparison frontends/src/quick_frontend/quick_contact_list.py @ 2120:4d9aeae5d9d0

quick frontend (contact list): fixed cached key removal
author Goffi <goffi@goffi.org>
date Sun, 15 Jan 2017 16:00:40 +0100
parents e8cb9cc09485
children df5cb9e7d0b7
comparison
equal deleted inserted replaced
2119:469702b46768 2120:4d9aeae5d9d0
393 # now the attributes we keep in cache 393 # now the attributes we keep in cache
394 # XXX: if entity is a full jid, we store the value for the resource only 394 # XXX: if entity is a full jid, we store the value for the resource only
395 cache_attr = cache[C.CONTACT_RESOURCES].setdefault(entity.resource, {}) if entity.resource else cache 395 cache_attr = cache[C.CONTACT_RESOURCES].setdefault(entity.resource, {}) if entity.resource else cache
396 for attribute, value in attributes.iteritems(): 396 for attribute, value in attributes.iteritems():
397 if value is None: 397 if value is None:
398 cache_attr[attribute].pop(value, None) 398 # XXX: pyjamas hack: we need to use pop instead of del
399 try:
400 cache_attr[attribute].pop(value)
401 except KeyError:
402 pass
399 else: 403 else:
400 cache_attr[attribute] = value 404 cache_attr[attribute] = value
401 405
402 # we can update the display 406 # we can update the display
403 self.update([entity], update_type, self.profile) 407 self.update([entity], update_type, self.profile)