[Erp5-report] r26185 - /erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 27 16:15:23 CET 2009


Author: kazuhiko
Date: Fri Mar 27 16:15:22 2009
New Revision: 26185

URL: http://svn.erp5.org?rev=26185&view=rev
Log:
fix a bug that causes a problem if uid==0L.

Modified:
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=26185&r1=26184&r2=26185&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Fri Mar 27 16:15:22 2009
@@ -1309,7 +1309,7 @@
     assigned_uid_dict = {}
 
     for object in object_list:
-      if not getattr(aq_base(object), 'uid', None):
+      if getattr(aq_base(object), 'uid', None) is None:
         try:
           object.uid = self.newUid()
         except ConflictError:
@@ -1330,9 +1330,9 @@
           index = long(index)
         except TypeError:
           index = None
-        if index is not None and index < 0:
-          raise CatalogError, 'A negative uid %d is used for %s. Your catalog is broken. Recreate your catalog.' % (index, path)
-        if index:
+        if index is not None:
+          if index < 0:
+            raise CatalogError, 'A negative uid %d is used for %s. Your catalog is broken. Recreate your catalog.' % (index, path)
           if uid != index or isinstance(uid, int):
             # We want to make sure that uid becomes long if it is an int
             LOG('SQLCatalog', WARNING, 'uid of %r changed from %r (property) to %r (catalog, by path) !!! This can be fatal. You should reindex the whole site immediately.' % (object, uid, index))




More information about the Erp5-report mailing list