Commit 77a9bae6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix a bug that causes a problem if uid==0L.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26186 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c0f4af89
......@@ -110,7 +110,7 @@ path_only</string> </value>
SELECT <dtml-if path_only>path<dtml-else>uid,path</dtml-if> from catalog \n
WHERE \n
1 = 1\n
<dtml-if uid>\n
<dtml-if expr="uid is not None">\n
AND <dtml-sqltest uid op=eq type="int">\n
</dtml-if>\n
<dtml-if uid_list>\n
......@@ -160,7 +160,7 @@ WHERE \n
SELECT <dtml-if path_only>path<dtml-else>uid,path</dtml-if> from catalog \n
WHERE \n
1 = 1\n
<dtml-if uid>\n
<dtml-if expr="uid is not None">\n
AND <dtml-sqltest uid op=eq type="int">\n
</dtml-if>\n
<dtml-if uid_list>\n
......
132
\ No newline at end of file
133
\ No newline at end of file
......@@ -1309,7 +1309,7 @@ class Catalog(Folder,
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 @@ class Catalog(Folder,
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))
......
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