From 5815d3cb19151141777ff799a8708e21527dcc4a Mon Sep 17 00:00:00 2001 From: Ayush Tiwari <ayush.tiwari@nexedi.com> Date: Thu, 29 Sep 2016 16:15:20 +0000 Subject: [PATCH] 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. --- product/ZSQLCatalog/SQLCatalog.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index e20c7b90b3..69646fd7a1 100644 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -1497,9 +1497,8 @@ class Catalog(Folder, for object in object_list: uid = getattr(aq_base(object), 'uid', None) - # Several Tool objects have uid=0 (not 0L) from the beginning, but - # we need an unique uid for each object. - if uid is None or isinstance(uid, int) and uid == 0: + # Generate unique uid for object having 0 or None as uid + if uid is None or uid == 0: try: object.uid = self.newUid() except ConflictError: -- 2.30.9