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 @@
<value> <string>if not len(path_list):\n
return\n
restrictedTraverse = context.getPortalObject().restrictedTraverse\n
argument_getter_dict = {}\n
if subscription_path:\n
subscription = restrictedTraverse(subscription_path)\n
getId = subscription.getGidFromObject\n
......@@ -63,26 +62,37 @@ else:\n
\n
method = context.z_catalog_syncml_document_list\n
\n
parameter_append_list = []\n
append = parameter_append_list.append\n
parameter_dict = {}\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
getter = None\n
if getter is None:\n
getter = lambda obj, property=property: getattr(obj, property)()\n
append((parameter_value_list, getter))\n
def generateParameterList():\n
parameter_append_list = []\n
append = parameter_append_list.append\n
parameter_dict = {}\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
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
MAX_PER_QUERY = 1000\n
\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
if obj.getPortalType() == "Integration Module":\n
object_list = obj()\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>
</item>
<item>
......
121
\ No newline at end of file
122
\ 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