Commit bac5ff3f authored by Jérome Perrin's avatar Jérome Perrin

core: implement Session.update

It was using the default UserDict.update implementation which did not remove
acquisition wrapper and eventually lead to ConnectionStateError like for example

> Shouldn't load state for erp5.portal_type.Interaction Workflow Interaction 0x6637 when the connection is closed

which was observed when deleting sale order lines (wich triggers some interaction)
parent f2d5b043
...@@ -105,6 +105,11 @@ class Session(UserDict): ...@@ -105,6 +105,11 @@ class Session(UserDict):
# save value without its acquisition context # save value without its acquisition context
UserDict.__setitem__(self, key, aq_base(item)) UserDict.__setitem__(self, key, aq_base(item))
def update(self, dict=None, **kwargs): # pylint: disable=redefined-builtin
for k, v in (dict or kwargs).iteritems():
# make sure to use our __setitem__ which removes acquistion wrappers
self[k] = v
class DistributedSession(Session): class DistributedSession(Session):
""" Distributed Session dictionary. """ Distributed Session dictionary.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment