Commit 60459cc6 authored by Jérome Perrin's avatar Jérome Perrin

Workflow: explain why we copy previous status dict in _executeTransition

parent 8a335cca
...@@ -785,6 +785,17 @@ class Workflow(XMLObject): ...@@ -785,6 +785,17 @@ class Workflow(XMLObject):
tool = self.getParentValue() tool = self.getParentValue()
state_var = self.getStateVariable() state_var = self.getStateVariable()
# `status_dict` will hold the new status.
# Unlike DCWorkflow implementation, we don't start with an empty dict, but start
# by making a copy of the current status dict, this way the string used as keys
# will be the same string instances and this will reduce the pickle size:
# Copying existing dict saves space: when __setitem__(key, value) points at an
# existing key, python will just keep the existing string as key, which then
# means if both history entries are pickled together, the keys will be stored
# just once instead of once per dict.
# This is especially important with ERP5's WorkflowVariable implemented with
# IdAsReferenceMixin, because every call to getReference return a different string.
status_dict = self.getCurrentStatusDict(ob) status_dict = self.getCurrentStatusDict(ob)
if tdef is None: if tdef is None:
......
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