Commit 5815d3cb authored by Ayush Tiwari's avatar Ayush Tiwari Committed by Romain Courteaud

sql_catalog: No need to check for type

In case uid=0, its already being treated as int, so there is no
need to check for type and add time to performance.
parent 7c7be184
...@@ -1497,9 +1497,8 @@ class Catalog(Folder, ...@@ -1497,9 +1497,8 @@ class Catalog(Folder,
for object in object_list: for object in object_list:
uid = getattr(aq_base(object), 'uid', None) uid = getattr(aq_base(object), 'uid', None)
# Several Tool objects have uid=0 (not 0L) from the beginning, but # Generate unique uid for object having 0 or None as uid
# we need an unique uid for each object. if uid is None or uid == 0:
if uid is None or isinstance(uid, int) and uid == 0:
try: try:
object.uid = self.newUid() object.uid = self.newUid()
except ConflictError: except ConflictError:
......
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