Commit 86e51867 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

catch any exception (except ConflictError).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41935 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 32117879
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Utils import UpperCase\n <value> <string>from Products.ERP5Type.Utils import UpperCase\n
from Products.ERP5.Document.Document import NotConvertedError\n from ZODB.POSException import ConflictError\n
\n \n
# Obtain the properties from the Z SQL Method itself, as like catalogObjectList.\n # Obtain the properties from the Z SQL Method itself, as like catalogObjectList.\n
method = context.z_catalog_sphinxse_index_list\n method = context.z_catalog_sphinxse_index_list\n
...@@ -67,17 +67,20 @@ for path in getPath:\n ...@@ -67,17 +67,20 @@ for path in getPath:\n
if obj is None:\n if obj is None:\n
continue\n continue\n
\n \n
try:\n
tmp_dict = {}\n
for property in property_list:\n for property in property_list:\n
if property == \'SearchableText\':\n if property == \'SearchableText\':\n
try:\n
value = obj.SearchableText()\n value = obj.SearchableText()\n
except NotConvertedError:\n
failed_path_list.append(path)\n
else:\n else:\n
try:\n
value = getattr(obj, \'get%s\' % UpperCase(property))()\n value = getattr(obj, \'get%s\' % UpperCase(property))()\n
except AttributeError:\n tmp_dict[property] = value\n
value = None\n except ConflictError:\n
raise\n
except:\n
failed_path_list.append(path)\n
else:\n
for property, value in tmp_dict.items():\n
parameter_dict.setdefault(property, []).append(value)\n parameter_dict.setdefault(property, []).append(value)\n
\n \n
if len(failed_path_list):\n if len(failed_path_list):\n
...@@ -86,7 +89,7 @@ if len(failed_path_list):\n ...@@ -86,7 +89,7 @@ if len(failed_path_list):\n
context.activate(activity=\'SQLQueue\', priority=5, serialization_tag=\'sphinxse_indexing\').SQLCatalog_catalogSphinxSE(getPath=failed_path_list)\n context.activate(activity=\'SQLQueue\', priority=5, serialization_tag=\'sphinxse_indexing\').SQLCatalog_catalogSphinxSE(getPath=failed_path_list)\n
else:\n else:\n
# if all objects are failed one, just raise an exception to avoid infinite loop.\n # if all objects are failed one, just raise an exception to avoid infinite loop.\n
raise NotConvertedError\n raise AttributeError, \'exception raised in indexing %r\' % failed_path_list\n
\n \n
if len(parameter_dict):\n if len(parameter_dict):\n
return method(**parameter_dict)\n return method(**parameter_dict)\n
......
9 11
\ No newline at end of file \ No newline at end of file
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