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

conflict solved


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1300 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 632146cd
...@@ -27,7 +27,7 @@ from zLOG import LOG ...@@ -27,7 +27,7 @@ from zLOG import LOG
import time import time
import sys import sys
UID_BUFFER_SIZE = 1000 UID_BUFFER_SIZE = 900
MAX_UID_BUFFER_SIZE = 20000 MAX_UID_BUFFER_SIZE = 20000
class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
...@@ -222,7 +222,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -222,7 +222,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
'uid' is the unique Catalog identifier for this object 'uid' is the unique Catalog identifier for this object
""" """
#LOG('Catalog object:',0,str(path)) LOG('Catalog object:',0,str(path))
# Prepare the dictionnary of values # Prepare the dictionnary of values
kw = {} kw = {}
...@@ -243,7 +243,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -243,7 +243,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if (uid != index): if (uid != index):
# Update uid attribute of object # Update uid attribute of object
uid = int(index) uid = int(index)
#LOG("Write Uid",0, "uid %s index %s" % (uid, index)) LOG("Write Uid",0, "uid %s index %s" % (uid, index))
object.uid = uid object.uid = uid
# We will check if there is an filter on this # We will check if there is an filter on this
# method, if so we may not call this zsqlMethod # method, if so we may not call this zsqlMethod
...@@ -253,7 +253,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -253,7 +253,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if self.filter_dict.has_key(method_name): if self.filter_dict.has_key(method_name):
portal_type = object.getPortalType() portal_type = object.getPortalType()
if portal_type not in (self.filter_dict[method_name]['type']): if portal_type not in (self.filter_dict[method_name]['type']):
#LOG('catalog_object',0,'XX1 this method is broken because not in types: %s' % method_name) LOG('catalog_object',0,'XX1 this method is broken because not in types: %s' % method_name)
continue continue
else: else:
expression = self.filter_dict[method_name]['expression_instance'] expression = self.filter_dict[method_name]['expression_instance']
...@@ -263,7 +263,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -263,7 +263,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if not result: if not result:
#LOG('catalog_object',0,'XX2 this method is broken because expression: %s' % method_name) #LOG('catalog_object',0,'XX2 this method is broken because expression: %s' % method_name)
continue continue
#LOG('catalog_object',0,'this method is not broken: %s' % method_name) LOG('catalog_object',0,'this method is not broken: %s' % method_name)
# Get the appropriate SQL Method # Get the appropriate SQL Method
# Lookup by path is required because of OFS Semantics # Lookup by path is required because of OFS Semantics
method = getattr(self, method_name) method = getattr(self, method_name)
...@@ -284,10 +284,11 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -284,10 +284,11 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
kw['path'] = path kw['path'] = path
kw['uid'] = int(index) kw['uid'] = int(index)
kw['insert_catalog_line'] = 0 kw['insert_catalog_line'] = 0
LOG("SQLCatalog Warning: insert_catalog_line, case1 value",0,0)
# LOG # LOG
# LOG("Call SQL Method %s with args:" % method_name,0, str(kw)) # LOG("Call SQL Method %s with args:" % method_name,0, str(kw))
# Alter row # Alter row
#LOG("Call SQL Method %s with args:" % method_name,0, str(kw)) LOG("Call SQL Method %s with args:" % method_name,0, str(kw))
method(**kw) method(**kw)
else: else:
# Get the appropriate SQL Method # Get the appropriate SQL Method
...@@ -300,18 +301,22 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -300,18 +301,22 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if catalog_path == "reserved": if catalog_path == "reserved":
# Reserved line in catalog table # Reserved line in catalog table
insert_catalog_line = 0 insert_catalog_line = 0
LOG("SQLCatalog Warning: insert_catalog_line, case2",0,insert_catalog_line)
elif catalog_path is None: elif catalog_path is None:
# No line in catalog table # No line in catalog table
insert_catalog_line = 1 insert_catalog_line = 1
LOG("SQLCatalog Warning: insert_catalog_line, case3",0,insert_catalog_line)
else: else:
LOG('SQLCatalog WARNING',0,'assigning new uid to already catalogued object %s' % path) LOG('SQLCatalog WARNING',0,'assigning new uid to already catalogued object %s' % path)
uid = 0 uid = 0
insert_catalog_line = 0 insert_catalog_line = 0
LOG("SQLCatalog Warning: insert_catalog_line, case4",0,insert_catalog_line)
if not uid: if not uid:
# Generate UID # Generate UID
index = self.newUid() index = self.newUid()
object.uid = index object.uid = index
insert_catalog_line = 0 insert_catalog_line = 0
LOG("SQLCatalog Warning: insert_catalog_line, case5",0,insert_catalog_line)
else: else:
index = uid index = uid
for method_name in self.sql_catalog_object: for method_name in self.sql_catalog_object:
...@@ -322,7 +327,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -322,7 +327,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
if self.filter_dict.has_key(method_name): if self.filter_dict.has_key(method_name):
portal_type = object.getPortalType() portal_type = object.getPortalType()
if portal_type not in (self.filter_dict[method_name]['type']): if portal_type not in (self.filter_dict[method_name]['type']):
#LOG('catalog_object',0,'XX1 this method is broken because not in types: %s' % method_name) LOG('catalog_object',0,'XX1 this method is broken because not in types: %s' % method_name)
continue continue
else: else:
expression = self.filter_dict[method_name]['expression_instance'] expression = self.filter_dict[method_name]['expression_instance']
...@@ -330,9 +335,9 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -330,9 +335,9 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
econtext = self.getExpressionContext(object) econtext = self.getExpressionContext(object)
result = expression(econtext) result = expression(econtext)
if not result: if not result:
#LOG('catalog_object',0,'XX2 this method is broken because expression: %s' % method_name) LOG('catalog_object',0,'XX2 this method is broken because expression: %s' % method_name)
continue continue
#LOG('catalog_object',0,'this method is not broken: %s' % method_name) LOG('catalog_object',0,'this method is not broken: %s' % method_name)
method = getattr(self, method_name) method = getattr(self, method_name)
if method.meta_type == "Z SQL Method": if method.meta_type == "Z SQL Method":
...@@ -345,7 +350,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -345,7 +350,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
value = value() value = value()
kw[arg] = value kw[arg] = value
except: except:
#LOG("SQLCatalog Warning: Callable value could not be called",0,str((path, arg, method_name))) LOG("SQLCatalog Warning: Callable value could not be called",0,str((path, arg, method_name)))
kw[arg] = None kw[arg] = None
method = aq_base(method).__of__(object.__of__(self)) # Use method in the context of object method = aq_base(method).__of__(object.__of__(self)) # Use method in the context of object
# Generate UID # Generate UID
......
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