Commit 94bedc0a authored by Jean-Paul Smets's avatar Jean-Paul Smets

There is no reason not to support sql_catalog_raise_error_on_uid_check for...

There is no reason not to support sql_catalog_raise_error_on_uid_check for both cases of UID inconsistency. UID change happens for example with inconsistent catalog and ZODB after disaster recovery. It can be useful to prevent raise during a double catalogin of the database after a disaster recovery. Else, it is just impossible to recover.
parent b5e86853
......@@ -1444,8 +1444,12 @@ class Catalog(Folder,
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
raise ValueError('uid of %r changed from %r (property) to %r '
'(catalog, by path) !!! This can be fatal' % (object, uid, index))
error_message = 'uid of %r changed from %r (property) to %r '\
'(catalog, by path) !!! This can be fatal' % (object, uid, index)
if not self.sql_catalog_raise_error_on_uid_check:
LOG("SQLCatalog.catalogObjectList", ERROR, error_message)
else:
raise ValueError(error_message)
else:
# Make sure no duplicates - ie. if an object with different path has same uid, we need a new uid
# This can be very dangerous with relations stored in a category table (CMFCategory)
......
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