Commit 5e07d8ab authored by Sebastien Robin's avatar Sebastien Robin

do not call the method if wa take the default value

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8437 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a2649e5
......@@ -85,13 +85,22 @@ class IdTool(UniqueObject, Folder):
l = threading.Lock()
l.acquire()
try:
last_id = self.dict_ids.get(id_group, default or 0)
class Dummy:
pass
dummy = Dummy()
last_id = self.dict_ids.get(id_group, dummy)
if last_id is dummy:
if default is None:
new_id=0
else:
new_id=default
# Now generate a new id
if method is not None:
new_id = method(last_id)
else:
new_id = last_id + 1
# Now generate a new id
if method is not None:
new_id = method(last_id)
else:
new_id = last_id + 1
# Store the new value
self.dict_ids[id_group] = new_id
......
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