Commit 1ec9153c authored by Yoshinori Okuji's avatar Yoshinori Okuji

Do not ignore ConflictError.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3857 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e48e00fc
...@@ -29,6 +29,7 @@ from DateTime import DateTime ...@@ -29,6 +29,7 @@ from DateTime import DateTime
from Products.PluginIndexes.common.randid import randid from Products.PluginIndexes.common.randid import randid
from Acquisition import aq_parent, aq_inner, aq_base, aq_self from Acquisition import aq_parent, aq_inner, aq_base, aq_self
from zLOG import LOG from zLOG import LOG
from ZODB.POSException import ConflictError
import time import time
import sys import sys
...@@ -520,6 +521,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -520,6 +521,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
method = getattr(self, method_name) method = getattr(self, method_name)
try: try:
method() method()
except ConflictError:
raise
except: except:
LOG('SQLCatalog Warning: could not clear catalog', 0, method_name, error=sys.exc_info()) LOG('SQLCatalog Warning: could not clear catalog', 0, method_name, error=sys.exc_info())
pass pass
...@@ -609,6 +612,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -609,6 +612,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
search_result = method(table=table) search_result = method(table=table)
for c in search_result: for c in search_result:
result_list.append(c.Field) result_list.append(c.Field)
except ConflictError:
raise
except: except:
LOG('WARNING SQLCatalog._getCatalogSchema failed with the method', 0, method_name, error=sys.exc_info()) LOG('WARNING SQLCatalog._getCatalogSchema failed with the method', 0, method_name, error=sys.exc_info())
pass pass
...@@ -683,6 +688,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -683,6 +688,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
search_result = method() search_result = method()
for c in search_result: for c in search_result:
keys.append(c[0]) keys.append(c[0])
except ConflictError:
raise
except: except:
pass pass
return keys return keys
...@@ -887,6 +894,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -887,6 +894,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
if not getattr(aq_base(object), 'uid', None): if not getattr(aq_base(object), 'uid', None):
try: try:
object.uid = self.newUid() object.uid = self.newUid()
except ConflictError:
raise
except: except:
raise RuntimeError, 'could not set missing uid for %r' % (object,) raise RuntimeError, 'could not set missing uid for %r' % (object,)
else: else:
...@@ -984,6 +993,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -984,6 +993,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
value = getattr(object, arg, None) value = getattr(object, arg, None)
if callable(value): if callable(value):
value = value() value = value()
except ConflictError:
raise
except: except:
value = None value = None
argument_cache[(object.uid, arg)] = value argument_cache[(object.uid, arg)] = value
...@@ -1002,6 +1013,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1002,6 +1013,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
#else: #else:
# profile_dict[method_name] += end_time.timeTime() - start_time.timeTime() # profile_dict[method_name] += end_time.timeTime() - start_time.timeTime()
#LOG('catalogObjectList', 0, '%s: %f seconds' % (method_name, profile_dict[method_name])) #LOG('catalogObjectList', 0, '%s: %f seconds' % (method_name, profile_dict[method_name]))
except ConflictError:
raise
except: except:
LOG("SQLCatalog Warning: could not catalog objects with method %s" % method_name,100, str(object_list)) LOG("SQLCatalog Warning: could not catalog objects with method %s" % method_name,100, str(object_list))
raise raise
...@@ -1030,6 +1043,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1030,6 +1043,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
try: try:
#if 1: #if 1:
method(uid = uid) method(uid = uid)
except ConflictError:
raise
except: except:
# This is a real LOG message # This is a real LOG message
# which is required in order to be able to import .zexp files # which is required in order to be able to import .zexp files
...@@ -1059,6 +1074,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1059,6 +1074,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
return search_result[0].uid return search_result[0].uid
else: else:
return None return None
except ConflictError:
raise
except: except:
# This is a real LOG message # This is a real LOG message
# which is required in order to be able to import .zexp files # which is required in order to be able to import .zexp files
...@@ -1082,6 +1099,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1082,6 +1099,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
return search_result[0].path return search_result[0].path
else: else:
return None return None
except ConflictError:
raise
except: except:
# This is a real LOG message # This is a real LOG message
# which is required in order to be able to import .zexp files # which is required in order to be able to import .zexp files
...@@ -1116,6 +1135,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1116,6 +1135,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
for k in brain.__record_schema__.keys(): for k in brain.__record_schema__.keys():
result[k] = getattr(brain,k) result[k] = getattr(brain,k)
return result return result
except ConflictError:
raise
except: except:
# This is a real LOG message # This is a real LOG message
# which is required in order to be able to import .zexp files # which is required in order to be able to import .zexp files
...@@ -1293,6 +1314,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1293,6 +1314,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
new_sort_index += ['%s' % key] new_sort_index += ['%s' % key]
sort_index = join(new_sort_index,',') sort_index = join(new_sort_index,',')
sort_on = str(sort_index) sort_on = str(sort_index)
except ConflictError:
raise
except: except:
LOG('SQLCatalog.buildSQLQuery',0,'WARNING, Unable to build the new sort index', error=sys.exc_info()) LOG('SQLCatalog.buildSQLQuery',0,'WARNING, Unable to build the new sort index', error=sys.exc_info())
pass pass
...@@ -1507,6 +1530,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1507,6 +1530,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
kw['used'] = used kw['used'] = used
kw['REQUEST'] = REQUEST kw['REQUEST'] = REQUEST
return self.queryResults(method, **kw) return self.queryResults(method, **kw)
except ConflictError:
raise
except: except:
LOG("Warning: could not search catalog",0,self.sql_search_results, error=sys.exc_info()) LOG("Warning: could not search catalog",0,self.sql_search_results, error=sys.exc_info())
return [] return []
...@@ -1523,6 +1548,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -1523,6 +1548,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
kw['used'] = used kw['used'] = used
kw['REQUEST'] = REQUEST kw['REQUEST'] = REQUEST
return self.queryResults(method, **kw) return self.queryResults(method, **kw)
except ConflictError:
raise
except: except:
LOG("Warning: could not count catalog",0,self.sql_count_results, error=sys.exc_info()) LOG("Warning: could not count catalog",0,self.sql_count_results, error=sys.exc_info())
return [[0]] return [[0]]
......
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