Commit db017786 authored by Aurel's avatar Aurel

make indexation of document into syncml works even for data coming from integration modules

parent 54da4f63
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
<value> <string>if not len(path_list):\n <value> <string>if not len(path_list):\n
return\n return\n
restrictedTraverse = context.getPortalObject().restrictedTraverse\n restrictedTraverse = context.getPortalObject().restrictedTraverse\n
argument_getter_dict = {}\n
if subscription_path:\n if subscription_path:\n
subscription = restrictedTraverse(subscription_path)\n subscription = restrictedTraverse(subscription_path)\n
getId = subscription.getGidFromObject\n getId = subscription.getGidFromObject\n
...@@ -63,26 +62,37 @@ else:\n ...@@ -63,26 +62,37 @@ else:\n
\n \n
method = context.z_catalog_syncml_document_list\n method = context.z_catalog_syncml_document_list\n
\n \n
parameter_append_list = []\n def generateParameterList():\n
append = parameter_append_list.append\n parameter_append_list = []\n
parameter_dict = {}\n append = parameter_append_list.append\n
for property in method.arguments_src.split():\n parameter_dict = {}\n
parameter_dict[property] = parameter_value_list = []\n for property in method.arguments_src.split():\n
if property == \'getData\':\n parameter_dict[property] = parameter_value_list = []\n
getter = getData\n if property == \'getData\':\n
elif property == \'getId\':\n getter = getData\n
getter = getId\n elif property == \'getId\':\n
else:\n getter = getId\n
getter = None\n else:\n
if getter is None:\n getter = None\n
getter = lambda obj, property=property: getattr(obj, property)()\n if getter is None:\n
append((parameter_value_list, getter))\n getter = lambda obj, property=property: getattr(obj, property)()\n
append((parameter_value_list, getter))\n
return parameter_dict, parameter_append_list\n
\n
MAX_PER_QUERY = 1000\n
\n \n
for path in path_list:\n for path in path_list:\n
obj = restrictedTraverse(path)\n obj = restrictedTraverse(path)\n
for value_list, getter in parameter_append_list:\n if obj.getPortalType() == "Integration Module":\n
value_list.append(getter(obj))\n object_list = obj()\n
method(**parameter_dict)\n else:\n
object_list = [obj,]\n
for x in xrange(0, len(object_list), MAX_PER_QUERY):\n
parameter_dict, parameter_append_list = generateParameterList()\n
for obj in object_list[x:x+MAX_PER_QUERY]:\n
for value_list, getter in parameter_append_list:\n
value_list.append(getter(obj))\n
method(**parameter_dict)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
121 122
\ 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