diff -r c024365ac8ac -r 07f453bf72e8 server/session.py --- a/server/session.py Mon Mar 25 14:16:16 2013 +0100 +++ b/server/session.py Mon Mar 25 16:20:25 2013 +0100 @@ -254,11 +254,8 @@ def set_entity_cache(self, entity): """Add `entity` to the transaction entity cache""" - try: - self.data['ecache'].setdefault(entity.eid, entity) - except KeyError: - self.data['ecache'] = ecache = {} - ecache[entity.eid] = entity + ecache = self.data.setdefault('ecache', {}) + ecache.setdefault(entity.eid, entity) def entity_cache(self, eid): """get cache entity for `eid`"""