diff --git a/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/SQLCatalog_indexSyncMLDocumentList.xml b/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/SQLCatalog_indexSyncMLDocumentList.xml index 7eecb850169b81c547a89698dab83f925238fbaa..11ba3d57879d91c54a71b0ba764598bc7e761c9d 100644 --- a/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/SQLCatalog_indexSyncMLDocumentList.xml +++ b/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/SQLCatalog_indexSyncMLDocumentList.xml @@ -50,56 +50,40 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>from Products.ERP5Type.Utils import UpperCase\n -from ZODB.POSException import ConflictError\n -# XXX Ã refaire pour optimisation\n + <value> <string>restrictedTraverse = context.getPortalObject().restrictedTraverse\n +argument_getter_dict = {}\n +if subscription_path:\n + subscription = restrictedTraverse(subscription_path)\n + getId = subscription.getGidFromObject\n + getData = subscription.getDataFromDocument\n +else:\n + getId = getData = None\n +\n method = context.z_catalog_syncml_document_list\n -property_list = method.arguments_src.split()\n +\n +parameter_append_list = []\n +append = parameter_append_list.append\n parameter_dict = {}\n -failed_path_list = []\n -restrictedTraverse = context.getPortalObject().restrictedTraverse\n -subscription = restrictedTraverse(subscription_path)\n -for path in path_list:\n - obj = restrictedTraverse(path, None)\n - try:\n - tmp_dict = {}\n - for property in property_list:\n - if subscription_path:\n - if property == "gid": \n - # Call specific method to compute GID on source data\n - value = subscription.getGidFromObject(obj)\n - elif property == "data":\n - value = subscription.getDataFromDocument(obj)\n - else:\n - value = getattr(obj, \'get%s\' % UpperCase(property))() \n - else:\n - if property == "gid":\n - # Signature GID is defined as its ID\n - value = getattr(obj, \'getId\')()\n - else:\n - value = getattr(obj, \'get%s\' % UpperCase(property))()\n - tmp_dict[property] = value\n - except ConflictError:\n - raise\n - except Exception, e:\n - raise\n - exception = e\n - failed_path_list.append(path)\n +for property in method.arguments_src.split():\n + parameter_dict[property] = parameter_value_list = []\n + if property == \'getData\':\n + getter = getData\n + elif property == \'getId\':\n + getter = getId\n else:\n - for property, value in tmp_dict.items():\n - parameter_dict.setdefault(property, []).append(value)\n + getter = None\n + if getter is None:\n + getter = lambda obj, property=property: getattr(obj, property)()\n + append((parameter_value_list, getter))\n +return parameter_dict, parameter_append_list\n \n -if len(failed_path_list):\n - if len(parameter_dict):\n - # reregister activity for failed objects only\n - activate_kw.update(activity=\'SQLQueue\', priority=5)\n - context.activate(**activate_kw).SQLCatalog_indexSyncMLSignatureList(path_list=failed_path_list)\n - else:\n - # if all objects are failed one, just raise an exception to avoid infinite loop.\n - raise AttributeError, \'exception %r raised in indexing %r\' % (exception, failed_path_list)\n \n -if parameter_dict:\n - return method(**parameter_dict)\n +parameter_dict, parameter_append_list = generateParameterList()\n +for path in path_list:\n + obj = restrictedTraverse(path)\n + for value_list, getter in parameter_append_list:\n + value_list.append(getter(obj))\n +method(**parameter_dict)\n </string> </value> </item> <item> diff --git a/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/z_get_syncml_path_list.xml b/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/z_get_syncml_path_list.xml index 1f5eee5f84a492058137f511a9fbe4fe3ca6413e..182066c2767ffb013aad0c75633b9e75462e3586 100644 --- a/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/z_get_syncml_path_list.xml +++ b/bt5/erp5_syncml/SkinTemplateItem/portal_skins/erp5_syncml/z_get_syncml_path_list.xml @@ -62,7 +62,7 @@ WHERE\n AND gid >= <dtml-sqlvar min_gid type="string">\n </dtml-if>\n <dtml-if max_gid>\n - AND gid <= <dtml-sqlvar max_gid type="string">\n + AND gid < <dtml-sqlvar max_gid type="string">\n </dtml-if>\n diff --git a/bt5/erp5_syncml/bt/revision b/bt5/erp5_syncml/bt/revision index c9c41087e2102d5af5f3ea8aa420e47ad3085707..2702ba3d439a353c3f748180065944feb28b8b87 100644 --- a/bt5/erp5_syncml/bt/revision +++ b/bt5/erp5_syncml/bt/revision @@ -1 +1 @@ -114 \ No newline at end of file +115 \ No newline at end of file