From fe0aada9173467e8f5dc4f01bbae51f44fa5f7ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Fri, 23 Mar 2007 14:29:44 +0000
Subject: [PATCH] use a Length object instead of an integer for
 security_uid_index.

Length instances are stored independantly in the ZODB, and as this property is
somehow often changed, it's better to have only a Length modified, not a
SQLCatalog. Also, without this, the history tab from the ZMI of the SQLCatalog
is unusable.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13595 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ZSQLCatalog/SQLCatalog.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py
index 959289b8c4..233d49c125 100644
--- a/product/ZSQLCatalog/SQLCatalog.py
+++ b/product/ZSQLCatalog/SQLCatalog.py
@@ -874,7 +874,7 @@ class Catalog( Folder,
 
   def _clearSecurityCache(self):
     self.security_uid_dict = OIBTree()
-    self.security_uid_index = 0
+    self.security_uid_index = Length()
 
   security.declarePrivate('getSecurityUid')
   def getSecurityUid(self, wrapped_object):
@@ -895,9 +895,10 @@ class Catalog( Folder,
       self._clearSecurityCache()
     if self.security_uid_dict.has_key(allowed_roles_and_users):
       return (self.security_uid_dict[allowed_roles_and_users], None)
-    self.security_uid_index = self.security_uid_index + 1
-    self.security_uid_dict[allowed_roles_and_users] = self.security_uid_index
-    return (self.security_uid_index, allowed_roles_and_users)
+    self.security_uid_index.change(1)
+    security_uid = self.security_uid_index()
+    self.security_uid_dict[allowed_roles_and_users] = security_uid
+    return (security_uid, allowed_roles_and_users)
 
   def clear(self):
     """
-- 
2.30.9