diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index e3052c17..eddbe9d5 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -1267,8 +1267,8 @@ class SatRosterProtocol(xmppim.RosterClientProtocol): if request.version is not None: # we update the cache in storage roster_cache = self.roster_cache - roster_cache[ROSTER_VER_KEY] = request.version roster_cache[entity.full()] = item.toElement().toXml() + roster_cache[ROSTER_VER_KEY] = request.version try: # update the cache for the groups the contact has been removed from left_groups = set(self._jids[entity].groups).difference(item.groups) @@ -1291,8 +1291,13 @@ class SatRosterProtocol(xmppim.RosterClientProtocol): if request.version is not None: # we update the cache in storage roster_cache = self.roster_cache + try: + del roster_cache[request.item.entity.full()] + except KeyError: + # because we don't use load(), cache won't have the key, but it + # will be deleted from storage anyway + pass roster_cache[ROSTER_VER_KEY] = request.version - del roster_cache[request.item.entity.full()] # we first remove item from local cache (self._groups and self._jids) try: