Commit d6b99b54 authored by Jean-Paul Smets's avatar Jean-Paul Smets

use newUid if new uid needed rather than immediateReindexObject


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2093 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 69089b24
...@@ -137,7 +137,7 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -137,7 +137,7 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
# Because of the order we generate accessors, it is still possible # Because of the order we generate accessors, it is still possible
# to overload data access for some accessors # to overload data access for some accessors
ps_list = tuple(ps_list) + getClassPropertyList(klass) ps_list = tuple(ps_list) + getClassPropertyList(klass)
LOG('ps_list',0, str(ps_list)) #LOG('ps_list',0, str(ps_list))
else: else:
ps_list = getClassPropertyList(klass) ps_list = getClassPropertyList(klass)
for base in ps_list: for base in ps_list:
...@@ -159,7 +159,7 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -159,7 +159,7 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
else: else:
prop_holder.security = ClassSecurityInfo() # Is this OK for security XXX ? prop_holder.security = ClassSecurityInfo() # Is this OK for security XXX ?
from Utils import initializeDefaultProperties from Utils import initializeDefaultProperties
LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__)) #LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__))
initializeDefaultProperties([prop_holder], object=self) initializeDefaultProperties([prop_holder], object=self)
#LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__)) #LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__))
# We should now make sure workflow methods are defined # We should now make sure workflow methods are defined
...@@ -927,10 +927,10 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -927,10 +927,10 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
# self.reindexObject() # self.reindexObject()
uid = getattr(aq_base(self), 'uid', None) uid = getattr(aq_base(self), 'uid', None)
if uid is None: if uid is None:
self.immediateReindexObject() # Required with deferred indexing self.uid = self.portal_catalog.newUid()
uid = getattr(aq_base(self), 'uid', None) uid = getattr(aq_base(self), 'uid', None)
if uid is None: if uid is None:
raise DeferredCatalogError('Could neither access uid nor generate it', context) raise DeferredCatalogError('Could neither access uid nor generate it', self)
return uid return uid
security.declareProtected(Permissions.AccessContentsInformation, 'getLogicalPath') security.declareProtected(Permissions.AccessContentsInformation, 'getLogicalPath')
......
...@@ -948,17 +948,12 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -948,17 +948,12 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
if not root_indexable: if not root_indexable:
return return
temp_list = object_list for object in object_list:
object_list = [] if getattr(aq_base(object), 'uid',None) is None:
for object in temp_list: try:
if getattr(aq_base(object), 'uid',None)==None: object._setUid(self.newUid())
# XXX should do something better except:
LOG('SQLCatalog.catalogObjectList, will catalog:',0,object.getPhysicalPath()) raise RuntimeError, 'could not set missing uid fro %r' % (object,)
object.immediateReindexObject()
#pass
#raise RuntimeError, '%r does not have uid' % (object,)
else:
object_list.append(object)
methods = self.sql_catalog_object_list methods = self.sql_catalog_object_list
for method_name in methods: for method_name in methods:
...@@ -1189,7 +1184,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1189,7 +1184,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Define related maps # Define related maps
# each tuple has the form (key, 'table1,table2,table3/column/where_expression') # each tuple has the form (key, 'table1,table2,table3/column/where_expression')
related_tuples = self.sql_catalog_related_keys related_tuples = self.sql_catalog_related_keys
LOG('related_tuples', 0, str(related_tuples)) #LOG('related_tuples', 0, str(related_tuples))
related_keys = [] related_keys = []
related_method = {} related_method = {}
related_table_map = {} related_table_map = {}
...@@ -1201,7 +1196,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1201,7 +1196,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
t_tuple = t.split('|') t_tuple = t.split('|')
key = t_tuple[0].strip() key = t_tuple[0].strip()
join_tuple = t_tuple[1].strip().split('/') join_tuple = t_tuple[1].strip().split('/')
LOG('related_tuples', 0, str(join_tuple)) #LOG('related_tuples', 0, str(join_tuple))
related_keys.append(key) related_keys.append(key)
method_id = join_tuple[2] method_id = join_tuple[2]
related_method[key] = method_id related_method[key] = method_id
......
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