Commit eac4b445 authored by Nicolas Dumazet's avatar Nicolas Dumazet

dict.setdefault is a nice way to do this


git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@36760 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 504723a3
......@@ -116,9 +116,7 @@ class ExplanationCache:
simulation_movement_id = simulation_movement.getId()
insert_movement = True
for path_id in container_path:
if local_path_dict.get(path_id, None) is None:
local_path_dict[path_id] = dict()
local_path_dict = local_path_dict[path_id]
local_path_dict = local_path_dict.setdefault(path_id, {})
if type(local_path_dict) is not types.DictType:
# A movement was already inserted
insert_movement = False
......@@ -300,4 +298,4 @@ def _getUnionBusinessProcess(explanation):
which are involved in the simulation trees related to explanation
"""
explanation_cache = _getExplanationCache(explanation)
return explanation_cache.getUnionBusinessProcess()
\ No newline at end of file
return explanation_cache.getUnionBusinessProcess()
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