[Erp5-report] r32501 daniele - /erp5/trunk/products/ZSQLCatalog/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 12 15:42:02 CET 2010


Author: daniele
Date: Fri Feb 12 15:42:01 2010
New Revision: 32501

URL: http://svn.erp5.org?rev=32501&view=rev
Log:
During the clear in SQLCatalog, not create of 'reserved' element if there is a portal ids

In hot reindexing during the 'double indexing' step, update the security
of object in the destination catalog too

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

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=32501&r1=32500&r2=32501&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Fri Feb 12 15:42:01 2010
@@ -728,7 +728,19 @@
   def getSecurityUid(self, wrapped_object):
     """
       Cache a uid for each security permission
-
+      Return a tuple with a security uid (string) and a new tuple content the
+      roles and users if not exist already.
+
+     With the roles of object, search the security_uid associate in the
+     catalog_innodb:
+      - if the security not exist a security uid is generated with id_tool
+        or security_uid_index property and
+        return the new security_uid and the tuple contains the new roles
+        to add the roles in roles_and_user table of the database.
+      - if the security exist the security uid is returned and the second
+        element is None for not recreate the security in roles_and_user
+        table of the database.
+                                   
       We try to create a unique security (to reduce number of lines)
       and to assign security only to root document
     """
@@ -797,8 +809,10 @@
     # Reserved uids have been removed.
     self.clearReserved()
 
-    # Add a dummy item so that SQLCatalog will not use existing uids again.
-    self.insertMaxUid()
+    id_tool = getattr(self.getPortalObject(), 'portal_ids', None)
+    if id_tool is None:
+      # Add a dummy item so that SQLCatalog will not use existing uids again.
+      self.insertMaxUid()
 
     # Remove the cache of catalog schema.
     if hasattr(self, '_v_catalog_schema_dict') :

Modified: erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py?rev=32501&r1=32500&r2=32501&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py [utf8] Fri Feb 12 15:42:01 2010
@@ -393,10 +393,12 @@
     """
     if self.default_sql_catalog_id == source_sql_catalog_id:
       self.default_sql_catalog_id = destination_sql_catalog_id
-      # Insert the latest generated uid.
-      # This must be done just before swaping the catalogs in case there were
-      # generated uids since destination catalog was created.
-      self[destination_sql_catalog_id].insertMaxUid()
+      id_tool = getattr(self.getPortalObject(), 'portal_ids', None)
+      if id_tool is None:
+        # Insert the latest generated uid.
+        # This must be done just before swaping the catalogs in case there were
+        # generated uids since destination catalog was created.
+        self[destination_sql_catalog_id].insertMaxUid()
 
     LOG('exchangeDatabases skin_selection_dict:',0,skin_selection_dict)
     if skin_selection_dict is not None:
@@ -836,8 +838,12 @@
           if self.hot_reindexing_state == HOT_REINDEXING_RECORDING_STATE:
             destination_catalog.recordObjectList(url_list, 1)
           else:
-            if wrapped_object_list:
-              destination_catalog.catalogObjectList(wrapped_object_list,**kw)
+            wrapped_destination_object_list = []
+            for obj in object_list:
+              wrap_obj = self.wrapObject(obj, sql_catalog_id=self.destination_sql_catalog_id)
+              wrapped_destination_object_list.append(wrap_obj)
+            if wrapped_destination_object_list:
+              destination_catalog.catalogObjectList(wrapped_destination_object_list,**kw)
 
     object_list[:] = failed_object_list
 




More information about the Erp5-report mailing list